Skip to content

Instantly share code, notes, and snippets.

@woogists
Created April 26, 2021 05:51
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogists/6f17d0979ec9810d3860d5c22c730e94 to your computer and use it in GitHub Desktop.
Save woogists/6f17d0979ec9810d3860d5c22c730e94 to your computer and use it in GitHub Desktop.
For the Facebook for WooCommerce extension. By default, the link that is shared with Facebook is an “Add to Cart” URL for your product to speed up the checkout process. You may want this to be the product URL for a number of reasons. If so, you can use this code snippet to send the product URL to Facebook instead - https://docs.woocommerce.com/d…
<?php // only copy this line if needed
/**
* Change checkout URLs to product URLs for Facebook products
*/
function sv_fbw_checkout_url_to_product( $product_data, $id ){
$product_data['checkout_url'] = $product_data['url'];
return $product_data;
}
add_filter( 'facebook_for_woocommerce_integration_prepare_product', 'sv_fbw_checkout_url_to_product', 100, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment