Okay
  Public Ticket #3761395
Price Shortcode / Code Snippet
Open

Comments

  • Miguel Zenha started the conversation

    Hi!

    I want to show the price in the product page with custom styling.

    To do that, I want to get the wholesale price and the retail price in PHP. Is this possible? I mean, is there any code snippet to print out these type of information?

    Best regards and tanks

  •  2,212
    WebWizards replied

    Hello Miguel,

    First, I just want to mention that the plugin does have a feature that can show B2B users both prices:

    https://woocommerce-b2b-plugin.com/docs/how-to-display-rrp-recommended-retail-price-to-b2b-users/

    With this feature, B2B users will see both prices. These prices have special classes that you could use for CSS styling.

     

    Specifically regarding your question on how to get those prices in PHP:

    -> Could you clarify, is your goal to show these 2 prices to all users (e.g. including logged out users), or only to logged in B2B users?

    I ask as the code would be different.

     

    Kind regards,

    Stefan

  • Miguel Zenha replied

    Hi!

    Sorry about the late response.

    That is exactly what I was looking for. I activated that option and the B2B users can now see the recommended retail price (RRP) and the wholesale price.

    However, I want to show the price in different areas of the product page, and that is why I opened this ticket, because styling it with CSS is not the best option.

    I have a custom code snippet that shows the RRP price by getting the product price: 

    $product->get_regular_price();


    But how can I get the price for the user that is currently logged in? There are 2 groups of B2B users.

    https://prnt.sc/c8ETc6eVxJw2

    About your question:
    -> Could you clarify, is your goal to show these 2 prices to all users (e.g. including logged out users), or only to logged in B2B users?

    The store that we are developing has restricted access. We activated the "Hide website / force login" option, so only logged in users can see the prices.

    Best regards and thanks for the assistance!