Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Thread Starter tom

    (@klickchoice)

    Thank you .
    Could you please help for this also
    on woocommerce shop page and ONLY on mobile view :
    there is a big gap between the add to cart button and the product images ony shop page. Is there anyway just to show the add to cart button full ( without hovering ) and also the gap between the button and the product image is lesser.

    Please give the sample code also .

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Not without seeing it and not if its a 3rd party theme

    @mikejolley, how the the return of this function (get_formatted_variation_attributes) is ordered?

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Order of definition I believe.

    Hello, is there something wrong in the below function? I am trying to get product variations name to appear and it’s not working. Please help…

    private static function getProductVariationName($orderItem) {
    $variationName = array();

    if ( !empty($orderItem[‘item_meta’][‘_variation_id’]) ) {
    foreach ($orderItem[‘item_meta’][‘_variation_id’] as $variation_id) {
    if ( !empty($variation_id) ) {
    $variation = wc_get_product($variation_id);
    $variationName = $variation->get_title();
    $attributes = $variation->get_variation_attributes();

    if ( !empty($attributes) ) {
    $extraAttributes = array();

    foreach ($attributes as $key => $value) {
    $attribute_key = urldecode(str_replace(‘attribute_’, ”, $key));

    if ( taxonomy_exists($attribute_key) ) {
    $term = get_term_by( ‘slug’, $value, $attribute_key);
    $label= wc_attribute_label($attribute_key, $orderItem);

    if ( !is_wp_error($term)
    && is_object($term)
    && $term->name
    && $label ) {
    $extraAttributes[] = $label . ‘: ‘ . $term->name;
    }
    }
    }

    if ( !empty($extraAttributes) ) {
    $variationName .= ‘ – ‘ . implode(‘, ‘, $extraAttributes);
    }
    }
    }
    }
    }

    return empty($variationName) ? $orderItem[‘name’] : $variationName;
    }

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Get variation name from variation id’ is closed to new replies.