For PHP Users
You have to define Call url in shipment carries
"callback_url"=> base_url().'shipment/rates'
add these in controller or file which you add in call url
$filename = time(); $input = file_get_contents('php://input'); file_put_contents($filename.'-input', $input); // parse the request $rates = json_decode($input, true); // log the array format for easier interpreting file_put_contents($filename.'-debug', print_r($rates, true)); // total up the cart quantities for simple rate calculations $quantity = 0; foreach($rates['rate']['items'] as $item) { $quantity =+ $item['quantity']; } // use number_format because shopify api expects the price to be "25.00" instead of just "25" // overnight shipping is 5 per item $overnight_cost = number_format(5, 2, '', ''); // overnight shipping is 1 to 2 days after today $on_min_date = date('Y-m-d H:i:s O', strtotime('+1 day')); $on_max_date = date('Y-m-d H:i:s O', strtotime('+2 days')); // build the array of line items using the prior values $output = array('rates' => array( array( 'service_name' => 'Shipment Local', 'service_code' => 'SL', 'total_price' => $overnight_cost, 'currency' => 'PKR', 'min_delivery_date' => $on_min_date, 'max_delivery_date' => $on_max_date ) )); // encode into a json response $json_output = json_encode($output); // log it so we can debug the response file_put_contents($filename.'-output', $json_output); // send it back to shopify print $json_output;
Change According to you needs
This is not Question!
This is Solution
Subject | Author | Posted |
---|---|---|
14m ago | ||
21m ago | ||
30m ago | ||
37m ago | ||
46m ago |
User | Count |
---|---|
258 | |
165 | |
137 | |
67 | |
39 |