Forum

Thread tagged as: Runway, Shop

Sharing a product page to Facebook with product image preview

Anyone had success sharing a product page to facebook and have the preview stuff work?

https://docs.grabaperch.com/perch/pages-and-nav/page-attributes/facebook-and-twitter-sharing/

Lexi McGee

Lexi McGee 3 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What problem are you seeing? I'm not sure how to help.

Trying to put the product image in the og:image meta tag.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What result are you getting, and what's your code?

Solved using

$img = perch_shop_product(perch_get('product'), [ 'skip-template' => true, 'raw' => true ])[0]['image'];

and then passing this as a variable.