DataTransformer
in package
Transforms WooCommerce entities into Stripe-compatible data structures.
This class is responsible for converting WooCommerce objects (Cart, Product, Order) into normalized data arrays that the Stripe JavaScript integration expects.
Table of Contents
Methods
- transform_cart() : array<string|int, mixed>
- Transform WooCommerce cart into Stripe data structure
- transform_customer() : array<string|int, mixed>
- transform_order() : array<string|int, mixed>
- Transform WooCommerce order into Stripe data structure
- transform_product() : array<string|int, mixed>
- Transform WooCommerce product into Stripe data structure
- get_line_items_from_cart() : array<string|int, mixed>
- Get generic line items from cart
- get_line_items_from_order() : array<string|int, mixed>
- Get generic line items from order
- get_line_items_from_product() : array<string|int, mixed>
- Get generic line items from product
- get_selected_shipping_method() : string
- Get selected shipping method ID
- get_shipping_options_from_cart() : array<string|int, mixed>
- Get generic shipping options from cart
Methods
transform_cart()
Transform WooCommerce cart into Stripe data structure
public
transform_cart(WC_Cart $cart) : array<string|int, mixed>
Parameters
- $cart : WC_Cart
Return values
array<string|int, mixed>transform_customer()
public
transform_customer(WC_Customer $customer) : array<string|int, mixed>
Parameters
- $customer : WC_Customer
Return values
array<string|int, mixed>transform_order()
Transform WooCommerce order into Stripe data structure
public
transform_order(WC_Order $order) : array<string|int, mixed>
Parameters
- $order : WC_Order
Return values
array<string|int, mixed>transform_product()
Transform WooCommerce product into Stripe data structure
public
transform_product(WC_Product $product) : array<string|int, mixed>
Parameters
- $product : WC_Product
Return values
array<string|int, mixed>get_line_items_from_cart()
Get generic line items from cart
private
get_line_items_from_cart(WC_Cart $cart) : array<string|int, mixed>
Parameters
- $cart : WC_Cart
Return values
array<string|int, mixed>get_line_items_from_order()
Get generic line items from order
private
get_line_items_from_order(WC_Order $order) : array<string|int, mixed>
Parameters
- $order : WC_Order
Return values
array<string|int, mixed>get_line_items_from_product()
Get generic line items from product
private
get_line_items_from_product(WC_Product $product) : array<string|int, mixed>
Parameters
- $product : WC_Product
Return values
array<string|int, mixed>get_selected_shipping_method()
Get selected shipping method ID
private
get_selected_shipping_method() : string
Return values
stringget_shipping_options_from_cart()
Get generic shipping options from cart
private
get_shipping_options_from_cart(WC_Cart|null $cart) : array<string|int, mixed>
Parameters
- $cart : WC_Cart|null