Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Algoritmika

    (@algoritmika)

    Hi @demian85,

    Sorry for the late reply.

    Unfortunately, it’s not as simple as it may seem. Variations’ EANs are updated via JavaScript. Before we try to solve it with the shortcode, could you please let me know if you’ve tried our “Single product page” options (in “WooCommerce > Settings > EAN > General”) – it should work with the variations out-of-the-box then. Are there any issues with the options? In that case, maybe it will be easier for me to fix those issues than to achieve what we need with the shortcode.

    Thread Starter Demian

    (@demian85)

    Hi,

    Yes, it works with default woocommerce page. But I use a product template, not the default woo page. Is it perhaps possible if I add specific classes to the parent’s wrappers? Will it connect?

    Thanks for helping!

    Plugin Author Algoritmika

    (@algoritmika)

    Hi @demian85,

    Please try adding span tag with the ean class to your shortcode, like this:

    [alg_wc_ean before='EAN: <span class="ean">' after='</span>']
    

    Please let me know if that works.

    Plugin Author Algoritmika

    (@algoritmika)

    @demian85,

    P.S. I’m now thinking – your main variable product EAN is probably empty, correct? If that’s the case, my previous suggestion won’t work, as before and after attributes will be ignored. Try this instead:

    EAN: <span class="ean">[alg_wc_ean]</span>
    
    Thread Starter Demian

    (@demian85)

    Hi @algoritmika

    Thank you for the suggestions. It’s not working unfortunately.

    I’m thinking to override the theme’s product template. How do I get the meta data for the ean?

    $product->get_meta_alg_ean() ?

    Plugin Author Algoritmika

    (@algoritmika)

    Hi @demian85,

    There are at least three ways:

    Class method

    $product->get_meta( '_alg_ean' );
    

    Function

    get_post_meta( $product->get_id(), '_alg_ean', true );
    

    Shortcode

    do_shortcode( '[alg_wc_ean product_id="' . $product->get_id() . '"]' );
    

    Hope this helps.

    Thread Starter Demian

    (@demian85)

    Thank you, I’m a little lost.

    I added the ean meta data to the sku data from the WPBakery product field element:

    elseif ( $type == 'sku' AND ( $product->get_sku() OR $product->is_type( 'variable' ) ) ) {
    	$_atts['class'] .= ' product_meta';
    	$value .= '<span class="w-post-elm-before">' . us_translate( 'SKU', 'woocommerce' ) . ': </span>';
    	$value .= '<span class="sku">' . ( ( $sku = $product->get_sku() ) ? $sku : us_translate( 'N/A', 'woocommerce' ) ) . '</span>';
    	$value .= '<span class="w-post-elm-before">EAN: </span>';
    	$value .= '<span class="ean">' . $product->get_meta( '_alg_ean' ) . '</span>';
    
    	// Rating
    }

    But as you can see, it’s not doing anything for the EAN.

    https://medicalwerff.nl/shop/littmann-stethoscoop-classic-iii/

    • This reply was modified 2 years, 12 months ago by Demian.
    • This reply was modified 2 years, 12 months ago by Demian.
    Plugin Author Algoritmika

    (@algoritmika)

    Hi @demian85,

    I believe we have the same problem as with shortcode here – we are trying to display EAN for the main product, which does not exist.

    Please try one more option – in “WooCommerce > Settings > EAN > Advanced” – set the “JS selector in variation” option to .single-product.

    Does it help?

    Thread Starter Demian

    (@demian85)

    @algoritmika yes it’s working now!

    Plugin Author Algoritmika

    (@algoritmika)

    Hi @demian85,

    Happy to hear it’s solved ?? Let me know if you need anything else.

    And if you like the plugin, please consider leaving me a rating.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘EAN for variations on product page’ is closed to new replies.