App reviews, troubleshooting, and recommendations
I've create a shopify app using Codeigniter 4. It's a carrier service app. The carrier service is created successfully and I can see it in my development store in settings under manage rates but I'm getting error while checking out. It says - Your cart has been updated and the items you added can’t be shipped to your address. Remove the items to complete your order. Below is the code to create the carrier service:
$response = $client->post( "carrier_services", [ "carrier_service" => [ 'active' => true, "name" => "Faast Delivery", "callback_url" => "https://app.faastdelivery.com/shopify/rate", "service_discovery" => true, ] ] );
And here is my callback function.
public function rate(){ // log the raw request -- this makes debugging much easier $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.50 per item $overnight_cost = number_format($quantity * 5.50, 2, '', ''); // regular shipping is 2.75 per item $regular_cost = number_format($quantity * 2.75, 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')); // regular shipping is 3 to 7 days after today $reg_min_date = date('Y-m-d H:i:s O', strtotime('+3 days')); $reg_max_date = date('Y-m-d H:i:s O', strtotime('+7 days')); // build the array of line items using the prior values $output = array('rates' => array( array( 'service_name' => 'Faast Delivery', 'service_code' => 'FSTD', 'total_price' => $overnight_cost, "description" => "This is the fastest option by far", 'currency' => 'EUR', 'min_delivery_date' => $on_min_date, 'max_delivery_date' => $on_max_date ), array( 'service_name' => 'Faast Delivery', 'service_code' => 'FSTD', 'total_price' => $regular_cost, "description" => "This is the fastest option by far", 'currency' => 'EUR', 'min_delivery_date' => $reg_min_date, 'max_delivery_date' => $reg_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 header('Content-Type: application/json'); echo $json_output; // return $json_output; }
Thanks in advance.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025