-
AuthorPosts
-
September 21, 2018 at 3:28 am #1012590
In order for the View Content pixel from facebook to fire, the woocommerce_after_single_product needs to be on the product page. Can I add this back in without it affecting the Theme? If so, how do I enable it.
September 21, 2018 at 3:30 pm #1012806Hey MonumentBrandsLLC,
Thank you for using Enfold.
I’m not sure I understand the issue. Where do you need that hook to be? The theme doesn’t remove it.
Best regards,
IsmaelSeptember 21, 2018 at 3:56 pm #1012814Hello,
I researched and saw that this was the hook that triggered the facebook pixel to mark a “View Content”. This should happen whenever someone goes to a product page. For some reason, Facebook isn’t picking up that our product pages are products. What details could I provide in order for you to determine the issue?September 21, 2018 at 4:26 pm #1012826Hi,
Enfold does not use a special template for shop or product pages – thus you can use the woocommerce_after_single_product action to add custom code to your product page without customizing the theme. You can use the action like:
add_action( 'woocommerce_after_single_product', 'avia_add_custom_code_after_single_product',10); function avia_add_custom_code_after_single_product() { echo 'Some code which is hooked on the woocommerce_after_single_product action!'; }
The sample code would add the sentence “Some code which is hooked on the woocommerce_after_single_product action!” to your product page. Note that the hooks won’t work on pages which use the advanced layout builder. You could use the filter like:
function avia_single_product_page_mod($content) { if (is_product()) { /* Insert your code here */ } return $content; } add_filter('avia_builder_precompile', 'avia_single_product_page_mod', 10, 1 );
and below “Insert your code here” you can add your code.
Best regards,
PeterSeptember 21, 2018 at 4:36 pm #1012827So that may be the problem right there. I am using the advanced layout builder on the product pages currently. Is this causing ALL hooks that exist to no longer function? If that’s the case, they wouldn’t be firing the pixel because there is no hook.
September 21, 2018 at 5:15 pm #1012842function avia_single_product_page_mod($content)
{
if (is_product())
{
/*
Insert your code here
*/
}
return $content;
}
add_filter(‘avia_builder_precompile’, ‘avia_single_product_page_mod’, 10, 1 );and this isn’t working when I try to save on my child theme functions.php
September 21, 2018 at 5:49 pm #1012849Just switched the theme back to what we were using before (Porto) and all pixels fire correctly on the product page. Hence, it is definitely something to do with the Enfold Theme that is causing the issue. Does the theme remove woocommerce hooks? If so, which ones and how do I enable them to work?
The Enfold theme is beautiful and easy to use, but it is already causing a loss of sales and ad optimizing. If this can’t be fixed, we’ll have to switch back to the Porto theme.
September 22, 2018 at 3:36 pm #1013082Hi,
Does the theme remove woocommerce hooks?
No the theme does not remove any hooks as long as you’re using the default wordpress editor. If you switch to the advanced layout builder the advanced layout builder templates are used which do not use/support woocommerce hooks out of the box.
Thus – if you want to use WooCommerce hooks – switch to the default editor. Then the default WooCommerce templates will be used and you can also use the woocommerce_after_single_product action.
Best regards,
Peter -
AuthorPosts
- You must be logged in to reply to this topic.