Skip to content

Commit 99744ea

Browse files
authored
#297 Updated OpenGraph Product attributes (#299)
1 parent 40068ef commit 99744ea

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

src/SEOTools/OpenGraph.php

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ public function setPlace($attributes = [])
644644

645645
/**
646646
* Set product properties.
647+
* Reference: https://developers.facebook.com/docs/marketing-api/catalog/reference/#example-feeds
647648
*
648649
* @param array $attributes opengraph product attributes
649650
*
@@ -652,25 +653,57 @@ public function setPlace($attributes = [])
652653
public function setProduct($attributes = [])
653654
{
654655
$validkeys = [
656+
// Required
657+
'brand',
658+
'availability',
659+
'condition',
660+
661+
// Conditionally required
662+
'locale',
663+
'plural_title',
664+
665+
// Conditionally required: https://developers.facebook.com/docs/payments/product/
666+
'price:amount', // Required if Static Pricing & not Dynamic Pricing
667+
'price:currency', // Required if Static Pricing & not Dynamic Pricing
668+
669+
// Optional
670+
'catalog_id',
671+
'item_group_id',
672+
'category',
673+
'gender',
674+
'gtin',
675+
'isbn',
676+
'mfr_part_no',
677+
678+
'sale_price:amount',
679+
'sale_price:currency',
680+
'sale_price_dates:start',
681+
'sale_price_dates:end',
682+
683+
684+
// Optional - extra
685+
'custom_label_0',
686+
'custom_label_1',
687+
'custom_label_2',
688+
'custom_label_3',
689+
'custom_label_4',
690+
691+
692+
// Deprecated
655693
'original_price:amount',
656694
'original_price:currency',
657695
'pretax_price:amount',
658696
'pretax_price:currency',
659-
'price:amount',
660-
'price:currency',
661697
'shipping_cost:amount',
662698
'shipping_cost:currency',
663699
'weight:value',
664700
'weight:units',
665701
'shipping_weight:value',
666702
'shipping_weight:units',
667-
'sale_price:amount',
668-
'sale_price:currency',
669-
'sale_price_dates:start',
670-
'sale_price_dates:end'
671703
];
672704

673705
$this->setProperties('product', 'productProperties', $attributes, $validkeys);
706+
674707
return $this;
675708
}
676709

0 commit comments

Comments
 (0)