Advanced Custom Fields: Shopify Collection Field Wordpress Plugin - Rating, Reviews, Demo & Download
Plugin Description
This ACF field will let you select a collection from your Shopify Store. Useful for building a site shared between WordPress and Shopify.
Before use make sure you have guzzle installed within your WordPress theme.
See: http://docs.guzzlephp.org/en/stable/overview.html
Once the ACF field has been added, the Shopify store details have been given, and a collection has been selected you will then be able to access the collections ID when get_field(‘NAME_OF_FIELD’) is called.
- Open the WordPress file where you’d like to make use of the selected Shopify collection (front-page.php for example).
- Store the collection ID into a variable by calling get_field(‘NAME_OF_FIELD’); In this case we’ll use $selected_collection_id as our variable name;
- Store the return of get_field_object(‘NAME_OF_FIELD’); into a variable. In this case lets use $selected_collection_field as our variable name.
- Store the Shopify store base URL into a variable by calling $base_url = $selected_collection_field[‘shopify_store_base_url’];
- Store the Shopify API Password into a variable by calling $api_pw = $selected_collection_field[‘shopify_store_api_pw’];
You can then use this ID, base URL and API paassword to make API requests to your store in whichever way you wish.
Some good examples of useage are:
- Display a block links on your WordPress homepage with the collection title and image
- Display the most recent/popular products from a selected collection on your WordPress site
- Display products from a particular collection on a related WordPress blog post
Compatibility
This ACF field type is compatible with:
* ACF 5