@jasen
In WooCommerce, the wc()
function can be used to retrieve various information and perform different actions related to the WooCommerce plugin. Here are some common use cases of the wc()
function:
- Get the current customer's details:
1
|
$customer = wc()->customer;
|
- Get an instance of the cart:
- Retrieve a list of available payment gateways:
1
|
$payment_gateways = wc()->payment_gateways->get_available_payment_gateways();
|
- Get the current order object:
1
|
$order = wc()->session->get('order_awaiting_payment');
|
- Perform actions related to payments:
1
|
$order_id = wc()->checkout()->create_order();
|
These are just a few examples of how you can use the wc()
function in WooCommerce. You can explore more functionalities by referring to the official WooCommerce documentation.