Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Custom Carrier Service not showig rates on checkout - I have development store

Custom Carrier Service not showig rates on checkout - I have development store

xtramiledev
Shopify Partner
4 0 0

Hi,
I'm new on Shopify apps. I'hv created a custom app that installs on shopify store admin and creates a custom service carrier. The carrier is added succesfully but the service's call back URL is not fetching rates from the file. here is the code:

New Carrier Code (It is working fine and carrier is created succesfully):

 

 

 

$new_carrier = array(
	"carrier_service" => array(
		"name" => 'Custom Shipping Rate Provider',
		"callback_url" => 'http://abc.local/dummy_service_callback.php',
		"service_discovery" => true
	)
); 

 

 

 

 

Callback URL file Code:

 

 

 

$carrier_services = [
    [
      'service_name' => 'Custom Shipping Rate 1',
      'service_code' => 'custom_rate_1',
      'total_price' => 10.00,
      'currency' => 'USD',
      'description' => 'All description is available...'
    ],
    [
      'service_name' => 'Custom Shipping Rate 2',
      'service_code' => 'custom_rate_2',
      'total_price' => 20.00,
      'currency' => 'USD',
      'description' => 'All description is available...'
    ]
  ];
  
  $callback_response = [
    'rates' => $carrier_services
  ];
  
  header('Content-Type: application/json');
  echo json_encode($callback_response);

 

 

 

 
I have added both of these URLs in the "Allowed redirection URL(s)" of the 'app setup'
http://abc.local/generate_token.php
http://abc.local/dummy_service_callback.php

1 - I am checking this on the development store
2 - The abc.local is my local machine, so the app code is on my local machine.

Need you people's suggestion, why the callback URL is not showing rates on the checkout
Thanks a lot.

Replies 2 (2)

xtramiledev
Shopify Partner
4 0 0

Hi, can anyone mention what is the possible solution of issue or where I have done wrong,
Thanks

Baifeng
Shopify Partner
2 0 0

@xtramiledev

sir, have you got the problem resolved? I have the exact same issue here. If you have a fix, please share. Thanks.