donutdan4114 / shopify

Shopify PHP SDK to easily interact with the Shopify API.
85 stars 39 forks source link

Allow for -optionally - pulling metafields for Products #3

Open stefanospetrakis opened 7 years ago

stefanospetrakis commented 7 years ago

Situation At the moment the Client class only pulls Products and their respective fields. In case the Shopify Product has some metafields attached to it, they are not made available through the client's getProducts and getProduct methods.

Current workaround It is still possible to retrieve the metafields through the get method.

Feature request The Product or Products returned from getProduct or getProducts could - optionally - return Product objects that include a metafields property with the metafields data.

Technical suggestion Since this is not a must-have for all use-cases of the Shopify client, it could be implemented as a Decorator class, so that an application needing access to the metafields of a product could simply do the following:

$client = new Shopify\PrivateApp($domain, $api_key, $password, $shared_secret));
$client = new MetafieldsClient($client);
krisztinatoth commented 7 years ago

+1, I would find this extremely useful too

LukeTowers commented 6 years ago

@stefanospetrakis @krisztinatoth my client gives you raw access to the Shopify API, perhaps you could give it a try: https://github.com/LukeTowers/php-shopify-api