Shopify simple PHP code: send product with Shopify JSON API
$2-8 USD / hour
Hello,
I am looking for freelancer to solve my problem. I have simple PHP code for Shopify API ([url removed, login to view]). I would like to send new product to Shopify thru API. When I have array deifinition like this:
$newproduct = array
(
"product"=>array
(
"title"=>"Title of product",
"body_html"=>"Product description",
"vendor"=>"Vendor",
"product_type"=>"Product type"
)
);
it works and new products is added to Shopify thru API. I do not know, how to change multiple array $newproduct. I would like to use my own variables. For example for title, I would like to use $title, for body_html I would like to use $body_html etc.
Then I can for example catch information from forms or other sources (like prepare form for adding Shopify products, then get information from $title = $_POST['title']).
So your task is simple: please write for me short code, so I can use PHP variables for big multiple array product. This is in my mind (and not working):
//Get title from previous form
$title = $_POST['title'];
$newproduct = array
(
"product"=>array
(
"title"=>$title,
"body_html"=>$body_html,
"vendor"=>$vendor,
"product_type"=>$product_type
)
);
I try also use combination with compact and than create new array for "product", but Shopify API tell me error.
Project ID: #1686123