Okay
  Public Ticket #2933020
Show B2C price to B2B users not working ajax
Closed

Comments

  •  6
    christian paton started the conversation

    HI there, there two things I wanted to ask about.

    1) I want use the "Show B2C price to B2B users (BETA option)" feature, but when in any product archive some products don't show both prices initially, which I assume it will only do if a B2B price has been set? But also, even when a B2B price has been set for a product, when the product is loaded in via infinite load/ajax it does not show both prices. Yet if you go to that products single page they will show. Case in point is this product 2022 DAILY DIARY Flying Cranes / Emerald, which will appear last on the category page. Obviously you need to be logged in as B2B though to see this, so let me know how I can supply the details.

    Category : https://staging8.esmie.co.uk/product-category/diaries/

    Single product : https://staging8.esmie.co.uk/product/2022-daily-diary-flying-cranes-emerald/

    2) How can I go about changing "Retail price:" and "Wholesale price:" text?

    cheers chris

  •  2,218
    WebWizards replied

    Hi Christian,

    Thank you for using our plugins,

    1) For customer support, kindly please provide us with your purchase code for the plugin. To get the code, you can go to https://codecanyon.net/downloads -> Click as it's shown in this image: 0?ui=2&ik=5a46e45e67&attid=0.3&permmsgid=msg-a:r-1923782612169588203&th=1761c0675bf89b03&view=fimg&sz=s0-l75-ft&attbid=ANGjdJ-zLMjn4syMQHE8EgxICLzCEo7MY-gzbNtDXzEyXGlgWDd6b9aUEtZexm03yOgZ9BwG43TM_dt9_phxajGStl_b05qEzbxpr_RgkODtTU2sZdzVgX9lOFBZyAY&disp=emb&realattid=ii_ki5by8ks2

    -> The text file downloaded should have something like this inside: Item Purchase Code: b3e5fe72-00b0-4019-a8e2-06fb26264742


    2)

    Regarding the issue you reported with prices during AJAX, I ran some tests and indeed I found the same issue.

    I believe I have an update that resolves the problem. I would like to attach it here for you - we need to enter your purchase code in our db for licensing purposes.


    3)

    You can modify the Retail Price / Wholesale Price text by using a translation plugin such as Loco Translate. You can use this method to change any text in the plugin, it does not matter that we're not actually translating to a different language. If you site language is set to en_GB, you can create an en_GB translation with Loco and then modify any text in the translation.

    We have a guide for working with Loco here: https://woocommerce-b2b-plugin.com/docs/how-to-translate-b2bking-to-any-language-localization/#4-toc-title


    Kind regards,

    Stefan


  •   christian paton replied privately
  •   WebWizards replied privately
  •   WebWizards replied privately
  •   christian paton replied privately
  •   christian paton replied privately
  •  2,218
    WebWizards replied

    Yes, you can overwrite the files inside the B2BKing plugin folder you mentioned.

    I'm not sure why the error though - it is working in my tests with various themes that use AJAX. 

    Could it be some kind of cache? please try to clear all.


    If you can't get it to work, could you share a backend login to the staging site so I can troubleshoot the issue? 

  •   christian paton replied privately
  •   WebWizards replied privately
  •  6
    christian paton replied

    That seems to do the trick, amazing, thank you!

    There are a couple of other little things that I would like to ask about if you don't mind. Apologies if this is outwith the scope of this ticket, I can always start another.

    1) My client wants variation prices to be intially in the format of "From £15.00" as opposed to "£20.00 – £36.00" and I can accomplish this for the B2B price using the woo filter 'woocommerce_variable_price_html', but I can't seem to access the B2C price here. Are there any filters that would allow me to play with this? You can see here : https://staging8.esmie.co.uk/product/2022-week-to-view-bouquet-spray-dark-blue/

    2) Generally do you have any functions that can be used to get a B2C or B2B price when given say a product object or ID? 

    cheers chris

  •  2,218
    WebWizards replied

    Glad that seemed to work!

    1) 

    I think I have a solution for this. Please try to replace your code with the variable_price_html hook, with the following code:

    function b2bking_format_price_range( $price, $from, $to ) {
        return 'From '.wc_price($from);
    } 
     
    add_filter( 'woocommerce_format_price_range', 'b2bking_format_price_range', 10, 3 );
    


    2)

    No functions unfortunately. Generally, to get the group price for a specific product, you can do this:

    $user_id = get_current_user_id();
    $product_id = 1234;
    $user_group = get_user_meta($user_id,'b2bking_customergroup',true);
    $regular_price = get_post_meta($product_id, 'b2bking_regular_product_price_group_'.$user_group, true );
    $sale_price = get_post_meta($product_id, 'b2bking_sale_product_price_group_'.$user_group, true );
  •  6
    christian paton replied

    They both work for me, so thanks again for the rapid support! 

    cheers chris