• Resolved hardyzbest

    (@hardyzbest)


    Is there a way to automatically update the shown price with the tiered price my customer selects?

    Like this:
    The current price of my article is 1 USD
    10+ would be 0.9 USD per unit
    Right now 1 USD is shown as price
    the customer chooses 10 units
    Now the shown price is 0.9 USD
    The customer puts the 10 articles in the cart

    If there isn’t any solution right now, I’d like to know where to add some code to have it.

    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter hardyzbest

    (@hardyzbest)

    I guess it must be something around 681 and 709 in the class-b2bking.public.php that could be added as a function in the functions.php ?

    Thread Starter hardyzbest

    (@hardyzbest)

    [EDIT]

    Please not the percent solution, we work with fixed prices per product and different customer roles. It has to this way.

    Plugin Author WebWizards

    (@webwizardsdev)

    I believe you can achieve what you’re looking for by enabling the “Show tiered price range” setting I described in the other ticket.

    With that setting enabled, you will see an “Active price” (current price) on the single product page (it does not work on archive pages).

    When the customer modifies the quantity, that active price changes.

    I would advise to also enable the settings “Color Price Range” and “Table is Clickable” in B2BKing -> Settings -> Tiered Pricing.

    Thread Starter hardyzbest

    (@hardyzbest)

    Nope, your snippet just replaces all prices no matter what I choose. There isn’t any kind of dynamic price change now.

    For everyone else, this is the code:

    <span style="font-family: Inconsolata, Consolas, Monaco, "Lucida Console", monospace; font-size: 14.4px; white-space: pre; background-color: rgb(240, 240, 240);">add_filter('b2bking_tiered_range_display_final', function($price, $min, $max, $product){
    	return wc_price($min);
    }, 10, 4);</span>
    Thread Starter hardyzbest

    (@hardyzbest)

    Here’s a perfect example of a product:

    https://mskprotect24.de/produkt/sicherheitsbrille-blues-clear/

    You can see two variations where the price changes how I want it but when I click on the smaller variation, the variation price keeps the smallest price instead of the current price.

    • This reply was modified 2 years, 2 months ago by hardyzbest.
    Thread Starter hardyzbest

    (@hardyzbest)

    I tried something like this:

    add_filter('b2bking_tiered_range_display_final', function($price, $min, $max, $product){
    	return '<span class="abpreisb2b"> ab </span>' .wc_price($min);
    }, 10, 4);
    
    
    add_filter('woocommerce_get_price', 'b2bking_tiered_range_display_final', function($price, $min, $max){
    	return wc_price($price);
    }, 10, 4);
    
    

    Bit it gave me a PHP error on the hooks.

    Plugin Author WebWizards

    (@webwizardsdev)

    I checked that product you linked. My impression is that there’s some kind of plugin or custom code that’s interfering with how this works – perhaps a plugin that enables variation functionality.

    Here’s how this works on my test site with this “Show tiered price range” feature enabled and this snippet added:

    add_filter('b2bking_tiered_range_display_final', function($price, $min, $max, $product){
    	return 'ab '.wc_price($min);
    }, 10, 4);

    Video: https://drive.google.com/file/d/1wPXMkUpYh52wN1d9Y-XVoSY7LtODEsp0/view

    (I get the same for variations).

    My suggestion would be to try and deactivate all site plugins to see how this works with default functionality.

    Thread Starter hardyzbest

    (@hardyzbest)

    Deactivated everything related to this but it doesn’t work like it should. It doesn’t switch back to the main price. I could live with this solution on simple products but it has to be put back to the normal price, when there’s no tiered price.

    Thread Starter hardyzbest

    (@hardyzbest)

    But the main problem is still the missing price I now called “Aktueller Staffel-Preis” in the other screenshots. The whole b2bking_tiered_active_price class is missing when using variable products. It’s always the woocommerce-variation-price class . I know I hide the woocommerce-variation-price class but only as long as it doesn’t work.

    Thread Starter hardyzbest

    (@hardyzbest)

    So, right now I made a quicky-and-dirty solution to atleast show the current price on every product using CSS. But the price is defined 2-3 times per product page. It would be awesome, if it’s somehow possible to replace woocommerce-variation-price with b2bking_tiered_active_price to see the selected tiered price.

    Plugin Author WebWizards

    (@webwizardsdev)

    I am not sure why you are not able to see the tiered_active_price price on variable products. I do see it on my end in local tests. Here’s what I see:

    View post on imgur.com

    There’s a range, table and active price for each variation. Perhaps it is because of other custom code.

    I could check this directly on your site if you want and look into this in more depth. For that it would be best if you please opened a ticket with us at https://webwizards.ticksy.com , the forum there is easier for us to work with for more complex matters,

    Thread Starter hardyzbest

    (@hardyzbest)

    Thanks for your effort but I guess what I want isn’t even possible without some dirty Javascript hacking, because the price field isn’t linked to the add-to-cart-button or the variation-selection.

    It works now in a way I’m almost happy with, so case closed as it’s not a problem YOU should fix as a third-party-developer. It’s more a WooCommerce-thing.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Update current price with selected price-tier’ is closed to new replies.