-
AuthorPosts
-
November 15, 2018 at 5:23 pm #1034047
Hi,
Can you help me move related products? I am not satisfied with the woocommerce standard “related products” function so I want to remove that and replace it with the plugin “woo related products”. At the moment “woo related products” are placed under the sidebar and I want that moved up where the standard “related products” is.
I do hope this makes sence.November 16, 2018 at 12:51 pm #1034427Hey ditteditte,
Could you post a link so that we can see the actual results you are getting please?
Best regards,
RikardNovember 16, 2018 at 2:22 pm #1034467November 17, 2018 at 8:33 am #1034685Hi,
Thanks for that, how exactly is the plugin adding the content? You should be able to remove the regular content if you follow this: https://docs.woocommerce.com/document/remove-related-posts-output/
Best regards,
RikardNovember 17, 2018 at 11:34 am #1034709Thank you. The plugin is adding the related products in the bottom om the page underneath the sidebar and I want that moved up underneath the product summary where the old related products was. Does that make sence?
November 21, 2018 at 12:09 pm #1036002Hi,
You should ask the plugin author for the actual hook/function that the plugin is using to render the related products and then remove it with the “remove_action” function. You can then use the plugin function back on another hook, or adjust the priority, to move the related post section wherever you like.
This one removes the default woocommerce related products section:
// https://docs.woocommerce.com/document/remove-related-posts-output/
Best regards,
IsmaelNovember 21, 2018 at 7:53 pm #1036298Can you help me do that in the right way?
To move the old related products function I used this code (and it worked perfectly):
______________________________
add_action( ‘init’, ‘enfold_customization_woocommerce_related’ );
function enfold_customization_woocommerce_related() {
remove_action( ‘woocommerce_after_single_product_summary’, ‘avia_woocommerce_output_related_products’, 20);
add_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_related_products’, 2);
}
______________________________
What the plugin auhtor write is:
______________________________
To remove related products block you can use
remove_action(‘woocommerce_after_single_product’, ‘wrprrdisplay’);
in your theme’s function.php file.If you want to add it again you can do something like this
add_action(‘woocommerce_after_single_product’, ‘wrprrdisplay’, 55);
or add_action(‘ANY-OTHER-HOOK’, ‘wrprrdisplay’, PRIORITY);
______________________________But i can’t seem to get it right. It is like something is missing.
November 23, 2018 at 9:30 am #1036879Hi,
Put that inside the previous init hook callback “enfold_customization_woocommerce_related” along with the previous modifications.
remove_action('woocommerce_after_single_product', 'wrprrdisplay'); add_action('woocommerce_after_single_product', 'wrprrdisplay', 20);
Best regards,
IsmaelNovember 23, 2018 at 3:48 pm #1036978I added this to my function.php file:
add_action( ‘init’, ‘enfold_customization_woocommerce_related’ );
function enfold_customization_woocommerce_related() {
remove_action(‘woocommerce_after_single_product’, ‘wrprrdisplay’);
add_action(‘woocommerce_after_single_product’, ‘wrprrdisplay’, 20);
}But it is still placed underneath the sidebar where no one will ever see it.
November 23, 2018 at 6:18 pm #1037047Hi,
Replace “woocommerce_after_single_product” with “woocommerce_after_single_product_summary” and play around with the priority value.
Best regards,
IsmaelNovember 29, 2018 at 4:43 pm #1039011Hi,
I tried this with different priority values, but nothing happens.add_action( ‘init’, ‘enfold_customization_woocommerce_related’ );
function enfold_customization_woocommerce_related() {
remove_action(‘woocommerce_after_single_product_summary’, ‘wrprrdisplay’);
add_action(‘woocommerce_after_single_product_summary’, ‘wrprrdisplay’, 20);
}December 3, 2018 at 4:39 am #1040096Hi,
Thanks for the update. This should work:
add_action( 'init', 'enfold_customization_woocommerce_related' ); function enfold_customization_woocommerce_related() { remove_action('woocommerce_after_single_product', 'wrprrdisplay'); add_action('woocommerce_after_single_product_summary', 'wrprrdisplay', 20); }
Again, you can adjust the priority value. If it doesn’t work, try this:
add_action( 'init', 'enfold_customization_woocommerce_related' ); function enfold_customization_woocommerce_related() { remove_action('woocommerce_after_single_product', 'wrprrdisplay'); add_action('woocommerce_after_single_product_title', 'wrprrdisplay', 20); }
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.