GMC谷歌商家中心设置结账按钮-WooCommerce购物网站
![](https://www.ningxiabohe.com/wp-content/uploads/image-160-1024x400.png)
在GMC中使用WooCommerce插件Google Listings & Ads插件导入产品时,商品ID自带gla_,但是添加结账链接时,需要的是类似https://test.com/checkout/?add-to-cart=5493的链接,所以需要去除gla_。
![](https://www.ningxiabohe.com/wp-content/uploads/image-161-1024x474.png)
修改woocommerce插件Google Listings & Ads文件-google-listings-and-ads.php,在最后添加代码去除GMC产品ID中的gla_
// Sync products without GLA prefix.
add_action(
'woocommerce_gla_get_google_product_offer_id',
function ( $mc_id, $product_id ) {
return (string) $product_id;
},
10,
2
);
![](https://www.ningxiabohe.com/wp-content/uploads/image-163-1024x489.png)
效果
![](https://www.ningxiabohe.com/wp-content/uploads/image-162-1024x458.png)