Relative Content

Tag Archive for woocommercewoocommerce-rest-api

What if user closes his browser before woocommerce_payment_complete action is performed?

I created an action that is performed after the user’s payment is complete and it’s working fine. But in a situation where my client exits his browser right after payment this action will not be performed. That is a problem because the action creates an API call with a hotel reservation. How can I ensure that the action is executed reliably, even if the user closes their browser immediately after making the payment?

Taxes are not being applied on line items when created from rest api

I am posting following data on rest api url “https://example.com/wp-json/wc/v3/orders”
{
“payment_method”: “cod”,
“payment_method_title”: “Cash on delivery”,
“set_paid”: true,
“customer_id”: 1200584,
“customer_note”: “Some of my notes”,
“billing”: {
“first_name”: “Example”,
“last_name”: “Developer”,
“address_1”: “Example address”,
“address_2”: “Delhi2”,
“city”: “Delhi”,
“state”: “Delhi”,
“postcode”: “110020”,
“country”: “IN”,
“email”: “[email protected]”,
“phone”: “9876543210”
},
“shipping”: {
“first_name”: “Example”,
“last_name”: “Developer”,
“address_1”: “Example address”,
“address_2”: “Delhi2”,
“city”: “Delhi”,
“state”: “Delhi”,
“postcode”: “110020”,
“country”: “IN”,
“email”: “[email protected]”,
“phone”: “9876543210”
},
“line_items”: [
{
“product_id”: “849660”,
“quantity”: 1,
“taxes”: [
{
“rate_code”: “IN-DL-CGST-1”,
“rate_id”: “9193”,
“label”: “CGST”,
“compound”: false,
“tax_total”: “0”,
“rate_percent”: “0%”
},
{
“rate_code”: “IN-DL-SGST-2”,
“rate_id”: “9229”,
“label”: “SGST”,
“compound”: false,
“tax_total”: “0”,
“rate_percent”: “0%”
},
{
“rate_code”: “IN-DL-IGST-3”,
“rate_id”: “9265”,
“label”: “IGST”,
“compound”: false,
“tax_total”: “38.095238”,
“rate_percent”: “5%”
}
]
}
],
“shipping_lines”: [
{
“method_id”: “flat_rate”,
“method_title”: “Flat Rate”,
“total”: “60.00”
}
],
“fee_lines”: [
{
“name”: “COD Charges”,
“total”: “30.00”
}
]
}