Skip to content

Instantly share code, notes, and snippets.

@stuli1989
Last active June 6, 2022 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuli1989/003d5f34953258cc97782d161be58271 to your computer and use it in GitHub Desktop.
Save stuli1989/003d5f34953258cc97782d161be58271 to your computer and use it in GitHub Desktop.
Field Name Variable Used What it gives us
Type $order Bento specific field, it lets it log that this is for an order.
id {{ item.entity_id }} Mageplaza retrieves the internal order id. For us it didn't represent the order id the customer sees.
incremet_id {{ item.increment_id }} Represents the order id our customers see.
ref {{ item.order_id }} Another internal reference id. Wasn't relevant for us but might be for you. We included it as it worked from another code sample we based this on.
ext_id {{ item.ext_order_id }} Another internal reference id. Wasn't relevant for us but might be for you. We included it as it worked from another code sample we based this on.
createdAt {{ item.created_at }} When was this order created.
total_value {{item.grand_total | times: ‘100’ }} The grand total for the order. This represents the final amount that you would be charging the customer. The times 100 helps to create the in cents value that most systems expect when ingesting webhooks.
shipping_amount {{item.shipping_amount | times: ‘100’ }} The shipping amount that you are charging this customer for the order. The times 100 helps to create the in cents value that most systems expect when ingesting webhooks.
discount_amount {{item.discount_amount | times: ‘100’ }} What the total discount applied for the customer has been. The times 100 helps to create the in cents value that most systems expect when ingesting webhooks.
paid {{item.total_paid | times: ‘100’ }} What is the final value that the customer has paid you. The times 100 helps to create the in cents value that most systems expect when ingesting webhooks.
state {{item.state}} Returns the Order state. Magento comes with the following out of the box - New, Processing, Complete, Pending Payment, Canceled, Closed, Payment Review, On hold
status {{item.status}} Returns the order status. Magento allows you to map custom statuses as needed. Might be useful to you if you have done the same.
subtotal {{ item.subtotal | times: ‘100’ }} The value before discounts. The times 100 helps to create the in cents value that most systems expect when ingesting webhooks.
total_invoiced {{item.total_invoiced | times: ‘100’ }} The final invoice value sent to customers. The times 100 helps to create the in cents value that most systems expect when ingesting webhooks.
weight {{item.weight}} The overall weight of the order. It is the total of all items in the package. We have ours denominated in kgs.
global_currency_code {{item.global_currency_code }} Currency Code.
store_currency_code {{item.store_currency_code }} Currency Code.
base_currency_code {{item.base_currency_code }} Currency Code.
order_currency_code {{item.order_currency_code }} Currency Code.
Products Repeated in case of multiple products.
Name {{ product.name | escape }} The name of the product ordered. Escape allows you to make sure that any symbols don't break your code.
qty {{ product.qty_ordered}} The final quantity of the specific product ordered.
sku {{ product.sku }} The sku of the product ordered.
total {{ product.price | times: ‘100’ }} The total price of a single unit of the product.
base_price {{ product.base_price | times: ‘100’ }} The base price of a single unit of the product. We have a tax inclusive price hence in some countries this might work to give you price with and without taxes.
row_total {{ product.row_total | times: ‘100’ }} The total quantity into base price of the product. Doesn't subtract any discounts.
discount_percent {{ product.discount_percent }} The percentage of discount applied to this row of products.
discount_amount {{ product.discount_amount | times: ‘100’ }} The overall amount of discount applied to this row of products.
Shipping Address
firstname {{ item.shippingAddress.firstname }} First name of the person the order is being shipped to.
lastname {{ item.shippingAddress.lastname }} Last name of the person the order is being shipped to.
email {{ item.shippingAddress.email }} Email id of the person the order is being shipped to
phone {{ item.shippingAddress.telephone }} Mobile phone number of the person the order is being shipped to.
mobile {{ item.shippingAddress.fax }} Fax number of the person the order is being shipped to.
state {{ item.shippingAddress.region }} State of the person the order is being shipped to.
street {{ item.shippingAddress.street }} Street of the person the order is being shipped to.
city {{ item.shippingAddress.city }} City of the person the order is being shipped to.
zipcode {{ item.shippingAddress.postcode }} Zipcode of the person the order is being shipped to.
country {{ item.shippingAddress.country_id }} Country of the person the order is being shipped to. Format returned is two letter code of the country.
Billing Address
firstname {{ item.shippingAddress.firstname }} First name of the person the order is being billed to.
lastname {{ item.shippingAddress.lastname }} Last name of the person the order is being billed to.
email {{ item.shippingAddress.email }} Email id of the person the order is being billed to
phone {{ item.shippingAddress.telephone }} Mobile phone number of the person the order is being billed to.
mobile {{ item.shippingAddress.fax }} Fax number of the person the order is being billed to.
state {{ item.shippingAddress.region }} State of the person the order is being billed to.
street {{ item.shippingAddress.street }} Street of the person the order is being billed to.
city {{ item.shippingAddress.city }} City of the person the order is being billed to.
zipcode {{ item.shippingAddress.postcode }} Zipcode of the person the order is being billed to.
country {{ item.shippingAddress.country_id }} Country of the person the order is being billed to. Format returned is two letter code of the country.
@baptiste09
Copy link

Hi @stuli1989,

Thanks for that super useful list, you saved me so much time with that webhook module configuration.
However, I'm not able to find similar list for all other hook types (customer, product, invoice, shipment, etc..).
Could you please share how you did build that list for order hook, in order for me to replicate this for the other hooks?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment