Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter palkhifashion

    (@palkhifashion)

    Found the solution. Thanks.

    add_filter('aepc_feed_item', function($fields, \PixelCaffeine\ProductCatalog\FeedMapper $item) {
    	($product = wc_get_product($item->get_item()->get_id()));
    	$fields['g:store_code'] = $product->get_attribute('storecode');
    	return $fields;
    }, 10, 2);

    Hello Antonino,
    First of all thanks for the great plugin. I am using the following code to define the “Store Code” attribute in the product feed.

    add_filter('aepc_feed_item', function($fields, \PixelCaffeine\ProductCatalog\FeedMapper $item) {
        if ($product = wc_get_product($item->get_item()->get_id())) {
            if(!empty($product->get_attribute('storecode')))
            {
                $fields['g:custom_label_0'] = $product->get_attribute('storecode');
            }
        }
             return $fields;
    
    }, 10, 2);

    I can get the value of that attribute in my product feed which is “1” as following :

    <g:google_product_category>Clothing & Accessories</g:google_product_category>
    <g:custom_label_0>1</g:custom_label_0>

    So How do I change
    <g:custom_label_0>1</g:custom_label_0> to <g:Store code>1</g:Store code>

    Thank you in advance.

Viewing 2 replies - 1 through 2 (of 2 total)