Okay
  Public Ticket #3705725
Custom Prices and WPML
Open

Comments

  •  2
    Lasse started the conversation

    Hi,

    We have a shop that uses B2BKing to control custom prices for logged-in users. This works perfectly. However, they also run WPML, and when a custom price is set, WPML overrides the custom pricing set by B2BKing.

    How can I make it so that when a user is logged in, they get the B2BKing price, and when they are not logged in and are on the Swedish version of the site, they get the normal price? In short, I just need B2BKing to always apply and only show the custom price from WPML if a user is not logged in.

    Attached files:  Skærmbillede 2024-08-15 151133.png

  •   WebWizards replied privately
  •  2
    Lasse replied

    Hi, I just testet it and unfortunatly it does not work. I think WPML is causing some trouble. When the user is not loged in, the see the "standard" price and not the WPML price. We also need to think about b2c customers with at profile. 

    In the script as i read it, all logged in, does not need to se the wpml price, but it's possible to have a customer in another contry, with the price from wplm. 

    I hope i makes sense - I can provide you with a login to the site if that will be of help.

  •  2
    Lasse replied

    Also a side thing - after i updated to the version you send. I get a Critical Error on the site, when i try to log in

  •  2,212
    WebWizards replied

    Hi again,

    In the script as i read it, all logged in, does not need to se the wpml price, but it's possible to have a customer in another contry, with the price from wplm. 

    It would help if you can please give more details on this. Which price should users get in the following scenarios?

    - Logged in B2B user DK

    - Logged in B2B user SE

    - Logged in B2C user DK

    - Logged in B2C user SE

    - Logged out user DK

    - Logged out user SE



    I hope i makes sense - I can provide you with a login to the site if that will be of help.

    That would be great. I am also not sure whether there's any other plugin / code / setting affecting things, so it would help to check directly. 

    We could also work on a staging clone site if it's easier that way (many hosting companies offer a feature to create a staging / dev site).

    I can also check the login issue that way.


    Kind regards,

    Stefan


  •  2
    Lasse replied

    Hi Stefan,

    Sorry for the long response time. 

    - Logged in B2B user DK | The one defined by b2bking

    - Logged in B2B user SE | The one defined by b2bking

    - Logged in B2C user DK | Standard price

    - Logged in B2C user SE | Standard price

    - Logged out user DK | Standard price

    - Logged out user SE | WPML price


    Regarding user; what mail should i grant access?

  •  2,212
    WebWizards replied

    Thank you for clarifying,

    I will try to set this up as you described it, through a code snippet.

     

    Please use our email at [email protected] for the account

  •   WebWizards replied privately
  •  2,212
    WebWizards replied

    Hi again,

    I logged into the site now and looked into this. I made an update to B2BKing that allows the code snippet I shared previously to work correctly.

    Then I tested with the following product: https://mbtshop.dk/wp-admin/post.php?post=12516&action=edit&lang=da&admin_bar=1

    When testing I see the following:

    https://www.loom.com/share/9be6ecb876e1446483c3c83b8024790f?sid=3871cf74-5f57-499c-8760-cc74c3b08889

    As B2B:

    • DK price: 80 (ex vat)
    • SK price: 80 (ex vat) 

    These are the B2BKing group prices as set on the product page, so I believe this is correct. WPML prices are not applying.

    As B2C:

    • DK price: 100 ( = 80 + vat)
    • SK price: 150 ( = 120 wpml price + vat)

    So I believe this is also correct, as WPML prices are now applying for the B2C user.

     

     

    For these cases:

    - Logged in B2C user DK

    - Logged in B2C user SE

    - Logged out user DK 

    - Logged out user SE

    Here B2BKing is not affecting the price in any way, so it would just give the prices as DK 100 and SK 150. Not entirely sure if you need this different.

     

    Let me know your thoughts please,

     

  •  2
    Lasse replied

    Hi, 

    Sorry to reopen - but after a long wait, the customer returned. They say: 

    When I log in as a Swedish B2B customer and in Swedish, I still get the Danish B2C prices ex VAT.

  •  2,212
    WebWizards replied

    Hi again,

     

    -> I'm not completely sure if I understand it correctly, it would help if we could look at an example of the issue.

    Are they basically saying that for example they're viewing a product as follows as a B2B user, and expecting to see the B2B price (90), but instead they get the B2C price (80) ?

    5887089142.png

     

    I think the problem may have to do with caching. I would suggest to try clearing all Litespeed caches + also try saving the product / changing product prices which usually clears caches.
     
     
    I looked into it on the site but could not really reproduce the issue. It would help a lot if they can share a specific example / product where they see the issue, and an explanation of the price they expect to see vs. what they see.