Viewing 1 replies (of 1 total)
  • Saif

    (@babylon1999)

    Hello @demixo,

    Thank you for reaching out!

    You can simply link the MPN to a product attribute field. :?)


    Link to image: https://d.pr/i/JsngDm

    For more context, kindly check: https://woo.com/document/google-listings-and-ads/#global-attribute-mapping

    For a more dynamic option, you can work with the woocommerce_gla_product_attribute_values filter.

    add_filter( 'woocommerce_gla_product_attribute_values', 'woocommerce_add_MPN_prefix' ,10,3 );
    
    function woocommerce_add_MPN_prefix( $attributes, $wc_product, $gla_product ) {
          return [ 'MPN' => 'gla_' . $wc_product->get_id() ];
    }
    }

    Kindly note the snippet above is just pseudo code (not tested). If you require the assistance of a developer, consider hiring a WooExpert. :?)

    Let us know if you have any other questions!

Viewing 1 replies (of 1 total)
  • The topic ‘How to use “gla_”+product_id as MPN?’ is closed to new replies.