Motocross Action
Showing 17–32 of 45 results
Showing 17–32 of 45 results
add_action('wp_footer', function () { if ( !function_exists('is_order_received_page') || !is_order_received_page() ) { return; } $order_id = absint(get_query_var('order-received')); $order = wc_get_order($order_id); if (!$order || !$order->is_paid()) { return; } // Verify access before displaying customer order information. $key = isset($_GET['key']) && is_string($_GET['key']) ? wc_clean(wp_unslash($_GET['key'])) : ''; if (!$key || !hash_equals($order->get_order_key(), $key)) { return; } $email = $order->get_billing_email(); $country = $order->get_shipping_country() ?: $order->get_billing_country(); if (!is_email($email) || !preg_match('/^[A-Z]{2}$/', $country)) { return; } $delivery_days = 0; foreach ($order->get_items() as $item) { // Uses the parent product's categories for variations. $product_id = $item->get_product_id(); $terms = wp_get_post_terms($product_id, 'product_cat'); $slugs = array(); if (!is_wp_error($terms)) { foreach ($terms as $term) { $slugs[] = $term->slug; $ancestors = get_ancestors( $term->term_id, 'product_cat', 'taxonomy' ); foreach ($ancestors as $ancestor_id) { $ancestor = get_term($ancestor_id, 'product_cat'); if ($ancestor && !is_wp_error($ancestor)) { $slugs[] = $ancestor->slug; } } } } $is_print = (bool) array_intersect( array( 'print-subscriptions', 'combo-offers', 'print-and-digital' ), $slugs ); $is_digital = in_array( 'digital-subscriptions', $slugs, true ); $is_renewal = (bool) array_intersect( array('renewal', 'renewals'), $slugs ); if ($is_digital && !$is_print) { // Digital-only subscriptions: immediate access. $days = 0; } elseif ($is_renewal) { // Print renewals: up to 60 days. $days = 60; } elseif ($is_print) { // New print subscriptions and print combos: 8 weeks. $days = 56; } else { // Back issues, merchandise and uncategorized products. $days = 21; } // Mixed orders use the longest delivery estimate. $delivery_days = max($delivery_days, $days); } $base_date = $order->get_date_paid() ?: $order->get_date_created(); if (!$base_date) { return; } $delivery_date = clone $base_date; $delivery_date->setTimezone(wp_timezone()); $delivery_date->modify('+' . $delivery_days . ' days'); $data = array( 'merchant_id' => 5500824269, 'order_id' => (string) $order->get_id(), 'email' => $email, 'delivery_country' => $country, 'estimated_delivery_date' => $delivery_date->format('Y-m-d'), 'opt_in_style' => 'CENTER_DIALOG', ); $json = wp_json_encode( $data, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT ); if (!$json) { return; } echo ''; echo ''; }, 30);
Showing 17–32 of 45 results
Showing 17–32 of 45 results