Home › Forums › WoodMart support forum › How to hide "External Only" products price?
How to hide "External Only" products price?
- This topic has 5 replies, 2 voices, and was last updated 6 years, 5 months ago by Elise Noromit.
-
AuthorPosts
-
July 26, 2018 at 10:22 pm #69475
jodyshopParticipantHi,
I have this code, which hides all prices from the entire website pages, but I want to only hide the external ones and keep the regular products prices intact.Here is the “Hide all code”
// Hide All Product Prices add_filter( 'woocommerce_variable_sale_price_html', 'remove_prices', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'remove_prices', 10, 2 ); add_filter( 'woocommerce_get_price_html', 'remove_prices', 10, 2 ); function remove_prices( $price, $product ) { $price = ''; return $price; }
Can you please help me how to accomplish that?
Thank you
July 26, 2018 at 11:57 pm #69479
jodyshopParticipantHi, again
Thanks for your consideration but, I have resolved the issue myself (as usual) 🙂
here is the solution for anyone having the same issue…
// Hide External Products Only Prices add_filter( 'woocommerce_variable_sale_price_html', 'woocommerce_remove_prices', 10, 2 ); add_filter( 'woocommerce_variable_price_html', 'woocommerce_remove_prices', 10, 2 ); add_filter( 'woocommerce_get_price_html', 'woocommerce_remove_prices', 10, 2 ); function woocommerce_remove_prices( $price, $product ) { if( $product->is_type( 'external' )) $price = ''; //$price = ' <a href='. esc_url( $product->get_product_url() ) .' target=_blank>Check Price</a> '; return $price; }
The above code hides all “external product prices only) and keep the regular variable product prices intact. Also, you can choose to replace the price space with ” ” empty space, or with external product link.
Just comment and uncomment the $price = ”; section.
Thank you
July 27, 2018 at 12:18 am #69483
jodyshopParticipantHi,
Why do I need to hide the external product prices?Well, Recently I get tons of emails from customers blaming me about different prices they see on my Jodyshop website, and when they redirected to Buy from Amazon they find a different price (sometimes completely another price).
Some customers called me a cheater ):
Sure, I keep the entire prices updated every 3 days, but when I check personally, I find either a different price (even after product synced with Amazon).
Anyway, now the prices are hidden for external products or affiliate products (so the customer can see he today’s fresh price).
But I kept the other products prices intact! Why?
Well, my Jodyshop is a tiny online marketplace, where sellers/vendors can register an account and start selling on my website (based on commission).
Here are the final 2 products look:
– External = without a price
– Variable = with a price.Thanks for your time reading this ):
Have a nice WordPress Coding 🙂July 27, 2018 at 7:29 am #69497
Elise NoromitMemberHello,
By default, WooCommerce does not have the option to hide price for one product type and show for another one.
Does your external product require “Add to cart button”? If no, you can just leave the price filed empty.
If you need “Add to cart button” you can hide the price with custom CSS which is added only in the certain product. http://prntscr.com/kbm94v This method, however, does not hide the price in shop page.
Best Regards
July 27, 2018 at 1:19 pm #69568
jodyshopParticipantSo, you’re trying to say that I am brilliant? I have done what I wanted.
You can check this page:
https://www.jodyshop.com/featured-products/There are 2 different types of products: External and Variable one with the price shown and the other with the price hidden 🙂
Keep it secret
Ops, it’s not in the Private Content section 🙂July 27, 2018 at 1:48 pm #69576
Elise NoromitMemberYou have solved your issue, haven’t you? If you have any questions please feel free to contact us.
Best Regards
-
AuthorPosts
The topic ‘How to hide "External Only" products price?’ is closed to new replies.
- You must be logged in to create new topics. Login / Register