• Resolved hesaplar

    (@hesaplar)


    Hello, I am using a wholesale b2bking plugin to modify product prices. For not loggedin users background price loading is working great but whenever product price is modified for logged in users, than background price loading is not working. Could you please help to solve the issue? Please see the video: https://www.loom.com/share/a23a6b5def304dc48277e9d5ea8d5421

    I may provide you login link in case you need to look at the code.

    Thanks in advance,

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Oscar Gare

    (@oscargare)

    Hi,

    The wholesale plugins could cause conflict because they overwrite the product’s price. The best solution here is to deactivate the “Price Based on Country” prices for the Wholesale users.

    Add the following snippet (note you have to replace “seller” with the user role you want to use for wholesale):

    function stop_price_based_country_for_vendors( $stop ) {
        $vendor_role = 'seller'; // Put here the wholesale role.
        $user  = wp_get_current_user();
        $roles = isset( $user->roles ) && is_array( $user->roles ) ? $user->roles : array();
        if ( in_array( $vendor_role, $roles ) ) {
            //The user is a vendor.
            $stop = true;
        }
        return $stop;
    }
    add_action('wc_price_based_country_stop_pricing','stop_price_based_country_for_vendors');
    

    You can follow the WPBeginner.com tutorial to add the code snippet:
    How to Easily Add Custom Code in WordPress (without Breaking Your Site)

    Thread Starter hesaplar

    (@hesaplar)

    Hi Oscar,

    But if your plugin stop working for a user role, than background price loading would stop too, right? Am I missing something? Main reason I would like to use the your plugin is to be able to load the prices on background to solve price issues related to cache since wholesale prices may be different for each logged in user.

    I tried to snippet but it still does not load prices on the background for user role. Here is the link to site: https://www.teashop.com.tr/menu/

    I would send you login link privately if you need to.

    Thanks in advance for your help.

    Plugin Author Oscar Gare

    (@oscargare)

    Hi,
    “The load product price in the background” feature will still work after you add the code snippet.
    The code snippet prevents the “pricing zones” from loading. So, for “wholesale” users, the page will display the price you define in the wholesale plugin (no multicurrency, no multi-price per country).

    Thread Starter hesaplar

    (@hesaplar)

    Hi Oscar, I followed your instruction but it did not solve, please see the video: https://www.loom.com/share/bf52e03cdf7a49a38a3a484523f394e2

    Plugin Author Oscar Gare

    (@oscargare)

    Hi @hesaplar,

    The “load product price in the background” option is designed to work with the pricing zone settings.
    If you use it in a different way, it’s very likely that it will not work as you expect.
    Having said that, what’s the price for the wholesale user, and what’s the price for the non-wholesale user? I see a different price for the user logged in and the guest in the video, so I think it is working as expected.

    If the b2bking plugin does not return the expected price, please contact b2bking support.

    Thank you.

    Thread Starter hesaplar

    (@hesaplar)

    Hi Oscar, prices form wholesale suite comes right in terms of data but price is not loading on the background by ajax which means that if I turned off litespeed cache vary, than everyone will see the same regular price even though price data is right that is why background loading is solving that problem of public cache of page. Please see the video here that shows same public price to everyone since price is not loaded dynamically by ajax and everyone sees the cached page price: https://www.loom.com/share/241138cbc5624dd9a52f84a0b8f1315a

    As a summary, I need to solve the background price loading issue with discounted prices so that I can get correct prices in every country for every users. So the issue is background loading ajax is not getting prices dynamically once wholesale plugin modifies prices, but if ajax would work, we know the data is right, so there is no conflict over data. Just ajax does not work.

    Thanks,

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Background price loading not working with discounted/wholesale prices’ is closed to new replies.