最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

woocommerce offtopic - Hide price and add to cart button on product page only

programmeradmin0浏览0评论

I’m using Datafeedr to show price comparison sets on a product page. The price comparison table opens up dynamically once the page is loaded. But because I want people to follow the link to the cheapest store that offers that product I really have no use for each imported product to show it’s own price. That price could be higher than the prices that are shown in the comparison table and the link of the button would then send the visitor to the wrong store. I have a plugin that turns of the prices and add to cart buttons, but it also turns of the prices on the category pages. And I do want the prices to show there because on the category pages people can filter the prices or set a price range. Can someone tell me with which snippets I can leave the prices in the category pages, but hide them on the single product pages and also how to hide the add to cart button? Thanks very much!

I’m using Datafeedr to show price comparison sets on a product page. The price comparison table opens up dynamically once the page is loaded. But because I want people to follow the link to the cheapest store that offers that product I really have no use for each imported product to show it’s own price. That price could be higher than the prices that are shown in the comparison table and the link of the button would then send the visitor to the wrong store. I have a plugin that turns of the prices and add to cart buttons, but it also turns of the prices on the category pages. And I do want the prices to show there because on the category pages people can filter the prices or set a price range. Can someone tell me with which snippets I can leave the prices in the category pages, but hide them on the single product pages and also how to hide the add to cart button? Thanks very much!

Share Improve this question asked Sep 16, 2019 at 17:23 Robert MacnielRobert Macniel 31 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

This will remove price and add to cart button on the product page Only

// Remove Price from the product page
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );

// Remove Add to cart form from the product page
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
发布评论

评论列表(0)

  1. 暂无评论