Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Custom order data example - Order attributes filter
Step 3. Saves any dynamic session variables to the Shopify order. Fires once the user clicks the checkout button.
function namespace_cart_checkout_attrs() {
// Gain access to the global $_SESSION variable
if (session_status() == PHP_SESSION_NONE) {
// Check to make sure our unique Session variable exists first
if ( isset($_SESSION['dynamic_values']) && $_SESSION['dynamic_values'] ) {
return $_SESSION['dynamic_values'];
add_filter('wps_cart_checkout_attrs', 'namespace_cart_checkout_attrs');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.