Shopify APP Coupon Code Generate expected Hash to be a Array Issue

YogeshVChikani
New Member
1 0 0

Hello Experts, 

 

I am an issue when i call price rules api. This error is related to prerequisite_customer_ids. Error is like below.

[response] => {"errors":{"prerequisite_customer_ids":"expected Hash to be a Array"}}

 My code

$rules = [
	
			"price_rule" => [
				
				"title"                     => "FRD123",
				"target_type"               => "line_item",
				"target_selection"          => "all",
				"allocation_method"         => "across",
				"value_type" 		    => "fixed_amount",
				"value" 	            => "-200.0",
				"customer_selection"        => "prerequisite",
				"starts_at" 		    => "2022-01-13T02:01:57Z",
				"usage_limit"        	    => 2,
				"once_per_customer"         => true,
				"prerequisite_customer_ids" => [ 5941795455117, 5944594104971 ],
				
			],
			
		];

		$res  	= shopify_call( $token, $shop, "/admin/api/2021-07/price_rules.json", $rules, 'POST' );
		$resp 	= json_decode( $res['response'], JSON_PRETTY_PRINT );
		$p_rule = $resp['price_rule'];

		
		echo "<pre>";
		print_r ($res);
		echo "</pre>";
		
		die;

 

Please Help Me
Thank You 🙂

Replies 0 (0)