Home Forums WoodMart support forum Woodmart Brand adding via Attributes has issue for Structured data

Woodmart Brand adding via Attributes has issue for Structured data

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #187502

    Local_IT
    Participant

    Google Structured DATA cant see Brands added via Attributes .
    Why?
    What is the solution ?

    #187518

    Artem Temos
    Keymaster

    Hi,

    Please, describe to us your problems in a bit more details. Attach some screenshots and provide us with a list of steps on how to reproduce it on your website. Have you tested how it works with a standard WordPress theme since this functionality is related to WooCommerce?

    Thank you in advance.

    #220899

    benrich
    Participant

    I assume he/she’s talking about

    
    <script type="application/ld+json">
    {
      @type: "Product",
      etc etc etc
    }
    </script>
    

    It’s missing the brand.

    I too would like to see this added.

    #221016

    Artem Temos
    Keymaster

    This functionality is a part of the WooCommerce plugin and our theme doesn’t influence this. You can check with a default WordPress theme.

    #221238

    benrich
    Participant

    This was my eventual implementation. It adds brand and all the gallery images.

    add_filter( 'woocommerce_structured_data_product', function( $markup, $product ) {
    
      // add Brand
      if($brand = $product->get_attribute( 'pa_brand' )) {
        $markup['brand'] = $brand;
      } 
    
      // product gallery images
      if($attachment_ids = $product->get_gallery_image_ids()) {
        $gallery_images = array($markup['image']);
        
        foreach( $attachment_ids as $attachment_id ) {
          $gallery_images[] = wp_get_attachment_url( $attachment_id );
        }
    
        $markup['image'] = $gallery_images;
      }
    
      return $markup;
    }, 10, 2 );
    

    If others find it useful

    #221278

    Artem Temos
    Keymaster

    Thank you very much for sharing your solution here.

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)