• Resolved ricardhh10

    (@ricardhh10)


    Hi, I hope you are having a great weekend!

    I have a question regarding the product_variation field, this field among other things, returns me the attribute “Size” along with its value. I wanted to know if it is possible that when a product has the tag “t-shirt”, it returns the size along with its value and a text next to it.

    For example: Size: S (t-shirt), other attributes, etc.

    Thank you for your support

    • This topic was modified 4 months, 1 week ago by ricardhh10.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello

    Can you open >Product >All Products, edit product , open variation “Size=S” and
    share the screenshot of this variation.

    But I’ll reply only tomorrow.

    Thread Starter ricardhh10

    (@ricardhh10)

    Hi, thanks for replying, I understand that you want me to “edit” any product from the list that appears. I attach an example image, although I must clarify that the attribute “Parche” may vary depending on the product

    https://imgur.com/a/mqytr6n

    Plugin Author algol.plus

    (@algolplus)

    hello

    please, open section “MIsc Settings” and add this code to it

    add_filter( 'woe_fetch_item_meta', function($value, $meta, $item, $product ){
    list($name,$attr) = explode(":",$value);
    if($name == "Size") {
    $post_id = $product->get_parent_id() ? $product->get_parent_id() : $product->get_id();
    $terms = get_the_terms( $post_id, "product_tag");
    if(!$terms) return $value; // no tags!
    foreach($terms as $term) {
    if($term->name == "t-shirt") $value .="(t-shirt)";
    }
    }
    return $value;
    },10,4);

    Thread Starter ricardhh10

    (@ricardhh10)

    Hi, the code works correctly for my problem, I appreciate it.

    Thank you very much.

    Plugin Author algol.plus

    (@algolplus)

    ??

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