• I’m using the shopisle theme.

    On the single product page it shows the price at the top, great, just like it should.

    On the variable product page, it shows an ugly formatted price range, and an ugly sale price range if you’re running a sale. Particularly, the dash that is between them is an awful font and is linked to everything else on the post, so changing just that dash, which is so low it looks like an underscore (which is why it’s ugly), is a bit of a task. I dug pretty deep into includes/templates/abstracts of woocommerce and couldn’t find where the dash between prices was put, or where to change it (e.g. a nearby filter hook).

    Instead, I opted to choose a default variant, and have the price that shows up when you have a variant selected moved to the top instead. Since you start with a variant selected, and I removed the “choose an option” option, there will always be a single price displayed on the variable product page. Great, that’s what I want.

    To finish it off, I just have to remove the price (or price range in the case of a variable product) that shows at the top by default. When I do just that, it works perfectly for variable products, but then single products have no visible price, so I need a way to remove that price, but ONLY for variable products. I’d try conditional tags (e.g. is_product()), but there’s nothing that identifies something as a variable product as far as I can tell. Also, I’d try to hook in to the price at the last moment with a filter (still learning filters too though) and delete it if I’m a variable product, but I’m not sure enough information is passed to the filter to determine that, and like I mentioned before, I couldn’t find where the actual dash was printed out, so even if I filtered the price, I wouldn’t be able to filter the dash as far as I could tell.

    Here’s the action I’m trying to remove, JUST for variable products:

    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 );

  • The topic ‘[WooCommerce] Move price on variable product page only’ is closed to new replies.