How to get product attribute in WooCommerce

Support MB Views How to get product attribute in WooCommerce

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #43248
    RoderickRoderick
    Participant

    Hi,

    I'm using MBViews to show WooComerce product attributes on a product page. However, I can't find a way to get an actual value. Could you guide me to what I should change?

    {% set product_location = mb.product.get_attribute('pa_location') %}
    <div>{{ product_location }}</div>
    #43257
    PeterPeter
    Moderator

    Hello,

    WooCommerce has its own function to get attributes and it is complicated to do that in View (Twig code). You can create a custom function to get attributes with PHP code, return the value and call it in View for easier.
    Refer to the documentation https://docs.metabox.io/extensions/mb-views/#running-php-functions

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.