Last active
January 23, 2018 17:56
-
-
Save arobbins/aedbe31bd4a24a740c48b003ff17381d to your computer and use it in GitHub Desktop.
Custom order data example - Order attributes filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
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) { | |
session_start(); | |
} | |
// 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