0

I have a website set up with the Shopify Modules where customers can place Shopify orders. When a customer adds an item to their cart, they fill out a webform on the website and then add the item to their Shopify cart. The order is then handled through Shopify. A Shopify webhook sends the order data back to the site, and the IP address from that data is used to pull the correct webform data and email the Shopify order data + webform data to me via a Rule.

This all works great when the customer's device is IPv4. When it is IPv6, though, Shopify is sending back an IPv4 address instead of the correct IPv6 one. The webform data has the correct IPv6 address, though, so the data is not being connected and I am not being emailed.

I'm not sure where it is getting this IP from but when I tried pinging it, it fails to communicate.

We use CloudFlare for our SSL, and have it set up so that CloudFlare maintains the customer's original IP address.

Our site is built in Drupal 7.63 and has Shopify API 7.x-1.0 Shopify eCommerce 7.x-1.0-beta3 installed.

Here is an example from an order I placed recently, from an IPv6 device:

  1. This image shows the Drupal webform data: with the IP address, 2607:fb90:3257:485f:800a:98d9:f2e2:2283

  2. This image shows my device's IP, 2607:fb90:3257:485f:800a:98d9:f2e2:2283: enter image description here

  3. Here is the webhook Shopify returned - you can see it includes the IPv4 address, 172.58.45.234 and not the IPv6 address:

orders_paid:array ( 'id' => 735508594739, 'email' => 'k.davis@evenvision.com', 'closed_at' => NULL, 'created_at' => '2019-01-30T15:25:27-05:00', 'updated_at' => '2019-01-30T15:25:28-05:00', 'number' => 121, 'note' => '', 'token' => '0f868d1fba0d5318c73fea7ea070aae8', 'gateway' => NULL, 'test' => false, 'total_price' => '0.00', 'subtotal_price' => '0.00', 'total_weight' => 0, 'total_tax' => '0.00', 'taxes_included' => false, 'currency' => 'USD', 'financial_status' => 'paid', 'confirmed' => true, 'total_discounts' => '5.00', 'total_line_items_price' => '5.00', 'cart_token' => '193643c6586c6ffeb36e44ddd3215e96', 'buyer_accepts_marketing' => false, 'name' => '#1121', 'referring_site' => '', 'landing_site' => '', 'cancelled_at' => NULL, 'cancel_reason' => NULL, 'total_price_usd' => '0.00', 'checkout_token' => 'e70b5f343abe0b0415216e658e1e3c95', 'reference' => NULL, 'user_id' => NULL, 'location_id' => NULL, 'source_identifier' => NULL, 'source_url' => NULL, 'processed_at' => '2019-01-30T15:25:27-05:00', 'device_id' => NULL, 'phone' => NULL, 'customer_locale' => 'en', 'app_id' => 580111, 'browser_ip' => NULL, 'landing_site_ref' => NULL, 'order_number' => 1121, 'discount_applications' => array ( 0 => array ( 'type' => 'discount_code', 'value' => '100.0', 'value_type' => 'percentage', 'allocation_method' => 'across', 'target_selection' => 'all', 'target_type' => 'line_item', 'code' => 'testing', ), ), 'discount_codes' => array ( 0 => array ( 'code' => 'testing', 'amount' => '5.00', 'type' => 'percentage', ), ), 'note_attributes' => array ( ), 'payment_gateway_names' => array ( ), 'processing_method' => 'free', 'checkout_id' => 7369638248499, 'source_name' => 'web', 'fulfillment_status' => NULL, 'tax_lines' => array ( ), 'tags' => '', 'contact_email' => 'k.davis@evenvision.com', 'order_status_url' => 'https://wildberries-store.myshopify.com/2635563059/orders/0f868d1fba0d5318c73fea7ea070aae8/authentic...', 'presentment_currency' => 'USD', 'total_line_items_price_set' => array ( 'shop_money' => array ( 'amount' => '5.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '5.00', 'currency_code' => 'USD', ), ), 'total_discounts_set' => array ( 'shop_money' => array ( 'amount' => '5.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '5.00', 'currency_code' => 'USD', ), ), 'total_shipping_price_set' => array ( 'shop_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), ), 'subtotal_price_set' => array ( 'shop_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), ), 'total_price_set' => array ( 'shop_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), ), 'total_tax_set' => array ( 'shop_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), ), 'total_tip_received' => '0.0', 'line_items' => array ( 0 => array ( 'id' => 1737267118131, 'variant_id' => 15880839135283, 'title' => 'Gift Card', 'quantity' => 1, 'price' => '5.00', 'sku' => '', 'variant_title' => '$5', 'vendor' => 'Wildberries Store', 'fulfillment_service' => 'manual', 'product_id' => 1635608494131, 'requires_shipping' => true, 'taxable' => false, 'gift_card' => false, 'name' => 'Gift Card - $5', 'variant_inventory_management' => NULL, 'properties' => array ( ), 'product_exists' => true, 'fulfillable_quantity' => 1, 'grams' => 0, 'total_discount' => '0.00', 'fulfillment_status' => NULL, 'price_set' => array ( 'shop_money' => array ( 'amount' => '5.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '5.00', 'currency_code' => 'USD', ), ), 'total_discount_set' => array ( 'shop_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), ), 'discount_allocations' => array ( 0 => array ( 'amount' => '5.00', 'discount_application_index' => 0, 'amount_set' => array ( 'shop_money' => array ( 'amount' => '5.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '5.00', 'currency_code' => 'USD', ), ), ), ), 'tax_lines' => array ( ), 'origin_location' => array ( 'id' => 678063276083, 'country_code' => 'US', 'province_code' => 'CA', 'name' => 'Wildberries Store', 'address1' => '747 13 th st', 'address2' => '', 'city' => 'Arcata', 'zip' => '95521', ), ), ), 'shipping_lines' => array ( 0 => array ( 'id' => 606462935091, 'title' => 'Pick up in store', 'price' => '0.00', 'code' => 'Pick up in store', 'source' => 'shopify', 'phone' => NULL, 'requested_fulfillment_service_id' => NULL, 'delivery_category' => NULL, 'carrier_identifier' => NULL, 'discounted_price' => '0.00', 'price_set' => array ( 'shop_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), ), 'discounted_price_set' => array ( 'shop_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), 'presentment_money' => array ( 'amount' => '0.00', 'currency_code' => 'USD', ), ), 'discount_allocations' => array ( ), 'tax_lines' => array ( ), ), ), 'billing_address' => array ( 'first_name' => 'Evenvision', 'address1' => 'test', 'phone' => NULL, 'city' => 'test', 'zip' => '97080', 'province' => 'Oregon', 'country' => 'United States', 'last_name' => 'test', 'address2' => '', 'company' => NULL, 'latitude' => 45.484172, 'longitude' => -122.3848749, 'name' => 'Evenvision test', 'country_code' => 'US', 'province_code' => 'OR', ), 'shipping_address' => array ( 'first_name' => 'Evenvision', 'address1' => 'test', 'phone' => NULL, 'city' => 'test', 'zip' => '97080', 'province' => 'Oregon', 'country' => 'United States', 'last_name' => 'test', 'address2' => '', 'company' => NULL, 'latitude' => 45.484172, 'longitude' => -122.3848749, 'name' => 'Evenvision test', 'country_code' => 'US', 'province_code' => 'OR', ), 'fulfillments' => array ( ), 'client_details' => array ( 'browser_ip' => '172.58.45.234', 'accept_language' => 'en-US,en;q=0.9', 'user_agent' => 'Mozilla/5.0 (Linux; Android 8.0.0; SM-G950U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.99 Mobile Safari/537.36', 'session_hash' => NULL, 'browser_width' => 360, 'browser_height' => 660, ), 'refunds' => array ( ), 'customer' => array ( 'id' => 604895117363, 'email' => 'k.davis@evenvision.com', 'accepts_marketing' => false, 'created_at' => '2018-06-21T20:01:10-04:00', 'updated_at' => '2019-01-30T15:25:28-05:00', 'first_name' => 'Kim', 'last_name' => 'Davis', 'orders_count' => 9, 'state' => 'enabled', 'total_spent' => '251.73', 'last_order_id' => 735508594739, 'note' => NULL, 'verified_email' => true, 'multipass_identifier' => NULL, 'tax_exempt' => false, 'phone' => NULL, 'tags' => '', 'last_order_name' => '#1121', 'currency' => 'USD', 'default_address' => array ( 'id' => 975763767347, 'customer_id' => 604895117363, 'first_name' => 'Evenvision', 'last_name' => 'test', 'company' => NULL, 'address1' => 'test', 'address2' => '', 'city' => 'test', 'province' => 'Oregon', 'country' => 'United States', 'zip' => '97080', 'phone' => NULL, 'name' => 'Evenvision test', 'province_code' => 'OR', 'country_code' => 'US', 'country_name' => 'United States', 'default' => true, ), ), )

  • I don't know the exact reason for this issue, but using IP addresses to track orders is a bad idea. Two users on the same office network may share an IP address for a start. – Alfred Armstrong Feb 2 at 17:30
  • Yeah, we realize that. But, it seems to be the best way to connect Shopify data with Drupal data. The other option would be something like email addresses, but that would be user-entered so could easily go wrong. Luckily, this is a relatively small store, and the system is set up so that two users would need to place simultaneous orders with the same IP for it to be an issue. And, we have a back up plan in place for when order data gets mixed. – Kimberlie Davis Feb 3 at 5:02
  • The Shopify API allows you to attach your own data to orders. I'd use the webform submission ID. help.shopify.com/en/api/reference/metafield But depending on the exact nature of the integration, there may be other possibilities. – Alfred Armstrong Feb 4 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.