[Plugin: Woocommerce - Php]Deciding when the customer can see the price (1 post)

  1. staff896
    Posted 2 years ago #

    I have a small problem with the php

    I'm working with woocommerce

    I sell ​​the products of two company
    The first company says that prices are only visible to registered customers
    The other company wants that prices are visible to all

    I set "if the customer is registered show prices, else show the Subscribe button."
    It's ok

    <?php if(is_user_logged_in()) { ?>
    display prices
    <?php } else { ?>
    display the Subscribe button
    <?php } ?>

    Now I thought to assign a class shipping to all products of the first manufacturer.

    I would insert:
    if the customer is not registered and if the class of shipment of the product is "company1" show the Subscribe button.

    So we have to see the button only if the user is not registered and the company is the "company1"

    If he is registered, we always have to see the price
    If he is not registered, but the company is not class 1 we always have to see the price

    <?php if(is_user_logged_in()) { (i have to write not)
    if (ship class is company1 ?????) ?>
    display the Subscribe button

    <?php } else { ?>
    display prices

    <?php } ?>

    Is it possible? Anyone have an idea how to do it?

    Thank you for your patience
    Have a nice evening!

Topic Closed

This topic has been closed to new replies.

About this Topic