woocommerce/pinterest-for-woocommerce

pinit.js script import is different from Pinterest documentation

ecgan opened this issue · 0 comments

Describe the bug:

In Pinterest's documentation https://developers.pinterest.com/docs/add-ons/save-button/, the pinit.js script should be imported in the page like this:

<script
    type="text/javascript"
    async defer
    src="//assets.pinterest.com/js/pinit.js"
></script>

However, in our extension, we are importing the script differently like this:

<script src="https://assets.pinterest.com/js/pinit.js?ver=1.4.0" defer="defer"></script>

The code for the script import comes from the following:

return '<script src="' . $src . '" defer="defer"></script>' . "\n"; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript --- Not enqueuing here.

In practice / in reality, the difference does not cause any issue in the extension functionality. We can still save or pin an image just fine. However, it seems to be causing confusions for our users and support teams.

In this issue, ideally we should update our code to match with the code snippet provided in Pinterest documentation, so that there are no differences and thus eliminate confusions for users and support teams.

Steps to reproduce:

  1. Go to a product page and view the page source.

Expected behavior:

The script import markup should match with the markup provided by Pinterest documentation.

Actual behavior:

The script import markup does not match with the markup provided by Pinterest documentation.

Additional details:

Related links:

  • p1712065430846929-slack-C7U3Y3VMY
  • 7884438-zd-a8c