Skip to content

Magento 2.4.5p1 Remove Price From Custom Product Options Drop Down – No Solution Working

Hello and thank you for any assistance with this. I have tried many things to make this work but nothing has worked so far.

I have tried every solution on this page:

Magento 2.2.3 – Remove price from select field on product page

https://community.magento.com/t5/Magento-2-x-Programming/Show-actual-price-for-each-option-in-dropdown-for-configurable/td-p/406916

The only one that works is adding script to the select.phtml. The problem with this is I have custom options types so I can pick when I want the price hidden vs not hidden. Cleverly Named DROP_DOWN_PRICE_HIDDEN…

I have select.php edited, multiple.php edited, I have deleted the price diff section from configurable.js.

No matter what I try it keeps coming back. None of the mixins worked for me or directly editing the core js files (just for test). Something new appears to be running on top of all these other places.

Also after any js edit I ran the following commands:

rm -rf var/*
rm -rf pub/static/frontend/* -R
bin/magento setup:static-content:deploy -f
history | grep di
bin/magento setup:di:compile
bin/magento s:up
bin/magento c:f

Can anyone help?

——————————-ADD ON——————–
While waiting I decided I would try to work with the JQUERY code which removes the price for ALL SELECT options. I tried to match the jquery by id since they are unique. Wouldn’t work, it deleted all the prices from each type of select. I decided to add a new class “name” into my custom option type. The jquery still overrides all select drop_downs. I have no idea why, this seemed like a quick fix now this doesn’t seem to be able to do the job either!

Here is the jquery code:

<script>
require(['jquery','domReady!'], function ($) {
$(document).ready(function(){
    $('select.price_hidden_select').change(function(){
        $('option').each(function(){
            var selectedOption = $(this).text();
                        if (selectedOption.indexOf('+') > -1) {
                            selectedOption = selectedOption.substring(0, selectedOption.indexOf('+'));
                $(this).text(selectedOption);
                        }
        });
    });
});
});
</script>