woocommerce / wc-api-ruby

A Ruby wrapper for the WooCommerce API.
MIT License
69 stars 74 forks source link

Accessing x-wp-total and x-wp-totalpages fails on this particular account #43

Closed achadee closed 6 years ago

achadee commented 6 years ago

Hi guys we have a woocommerce that is loading the headers x-wp-total and x-wp-totalpages in postman as seen in the sceenshot below:

screen shot 2018-04-28 at 12 05 34 pm

but when I run the same query via the ruby gem, it omits the headers

request:

api.get('products?page=1&per_page=' + (search_params.page_size || 25), function(err, data, res) {

      console.log('headers', data.headers)

      // return response
      const response = {
        statusCode: 200,
        body: JSON.stringify({
          result: true,
          page_count: parseInt(data.headers['x-wp-totalpages']),
          page_size: (search_params.page_size || 25)
        })
      };

      callback(null, response);
    });

logged response:

{ date: 'Sat, 28 Apr 2018 01:51:48 GMT',
  'content-type': 'text/html; charset=UTF-8',
  'transfer-encoding': 'chunked',
  connection: 'close',
  'set-cookie': [ '__cfduid=d8b13fb621d86965f62633229257cdf721524880308; expires=Sun, 28-Apr-19 01:51:48 GMT; path=/; domain=.robbostackle.com; HttpOnly' ],
  'x-powered-by': 'PHP/7.0.29',
  'cache-control': 'max-age=0',
  expires: 'Sat, 28 Apr 2018 01:51:48 GMT',
  'host-header': '192fc2e7e50945beb8231a492d6a8024',
  vary: 'Accept-Encoding',
  'x-proxy-cache': 'MISS',
  'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
  server: 'cloudflare',
  'cf-ray': '4125e2c73c6c51f7-MEL' }

I know this is probably not a problem with the ruby gem, but I'm thinking along the lines of the customer might need to expose headers based on the user agent or something??

Any input on this?

System satus

WordPress Environment

Home URL: https://www.robbostackle.com Site URL: https://www.robbostackle.com WC Version: 3.3.5 Log Directory Writable: ✔ WP Version: 4.9.5 WP Multisite: – WP Memory Limit: 1,000 MB WP Debug Mode: – WP Cron: ✔ Language: en_GB

Server Environment

Server Info: Apache/2.4.29 (Unix) mod_hive/6.6 OpenSSL/1.0.1e-fips mod_fastcgi/2.4.6 PHP Version: 7.0.29 PHP Post Max Size: 500 MB PHP Time Limit: 600 PHP Max Input Vars: 10000 cURL Version: 7.53.0 OpenSSL/1.0.2k

SUHOSIN Installed: – MySQL Version: 5.6.36 Max Upload Size: 500 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔

Database

WC Database Version: 3.3.5 WC Database Prefix: wpq3_ Total Database Size: 86.64MB Database Data Size: 59.34MB Database Index Size: 27.30MB wpq3_woocommerce_sessions: Data: 0.56MB + Index: 0.02MB wpq3_woocommerce_api_keys: Data: 0.00MB + Index: 0.01MB wpq3_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB wpq3_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB wpq3_woocommerce_order_items: Data: 0.01MB + Index: 0.01MB wpq3_woocommerce_order_itemmeta: Data: 0.05MB + Index: 0.04MB wpq3_woocommerce_tax_rates: Data: 0.00MB + Index: 0.01MB wpq3_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB wpq3_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB wpq3_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB wpq3_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB wpq3_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB wpq3_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB wpq3_woocommerce_log: Data: 0.00MB + Index: 0.00MB wpq3_commentmeta: Data: 0.00MB + Index: 0.00MB wpq3_comments: Data: 0.02MB + Index: 0.02MB wpq3_crony_jobs: Data: 0.02MB + Index: 0.00MB wpq3_crony_logs: Data: 0.02MB + Index: 0.00MB wpq3_links: Data: 0.00MB + Index: 0.00MB wpq3_linksync_laidKey: Data: 0.02MB + Index: 0.00MB wpq3_linksync_log: Data: 0.48MB + Index: 0.00MB wpq3_options: Data: 0.84MB + Index: 0.07MB wpq3_pmxe_exports: Data: 0.70MB + Index: 0.00MB wpq3_pmxe_google_cats: Data: 0.26MB + Index: 0.05MB wpq3_pmxe_posts: Data: 4.94MB + Index: 2.16MB wpq3_pmxe_templates: Data: 0.00MB + Index: 0.00MB wpq3_pmxi_files: Data: 0.01MB + Index: 0.00MB wpq3_pmxi_history: Data: 0.00MB + Index: 0.00MB wpq3_pmxi_imports: Data: 1.36MB + Index: 0.00MB wpq3_pmxi_posts: Data: 5.81MB + Index: 2.24MB wpq3_pmxi_templates: Data: 0.20MB + Index: 0.00MB wpq3_postmeta: Data: 32.80MB + Index: 11.13MB wpq3_posts: Data: 4.01MB + Index: 1.10MB wpq3_po_plugins: Data: 3.52MB + Index: 5.91MB wpq3_qss: Data: 0.17MB + Index: 0.05MB wpq3_redirection_404: Data: 0.45MB + Index: 0.56MB wpq3_redirection_groups: Data: 0.02MB + Index: 0.03MB wpq3_redirection_items: Data: 0.02MB + Index: 0.08MB wpq3_redirection_logs: Data: 0.02MB + Index: 0.08MB wpq3_sbb_blacklist: Data: 0.20MB + Index: 0.08MB wpq3_snp_log: Data: 0.02MB + Index: 0.00MB wpq3_snp_stats: Data: 0.02MB + Index: 0.05MB wpq3_social_users: Data: 0.00MB + Index: 0.00MB wpq3_termmeta: Data: 0.76MB + Index: 0.61MB wpq3_terms: Data: 0.31MB + Index: 0.44MB wpq3_term_relationships: Data: 0.89MB + Index: 1.77MB wpq3_term_taxonomy: Data: 0.39MB + Index: 0.62MB wpq3_usermeta: Data: 0.17MB + Index: 0.09MB wpq3_users: Data: 0.02MB + Index: 0.02MB wpq3_wcpdf_invoice_number: Data: 0.02MB + Index: 0.00MB wpq3_wc_download_log: Data: 0.02MB + Index: 0.03MB wpq3_wc_point_of_sale_sale_reports: Data: 0.00MB + Index: 0.00MB wpq3_wc_webhooks: Data: 0.02MB + Index: 0.02MB wpq3_wd_fb_data: Data: 0.05MB + Index: 0.00MB wpq3_wd_fb_info: Data: 0.02MB + Index: 0.00MB wpq3_wd_fb_option: Data: 0.02MB + Index: 0.00MB wpq3_wd_fb_shortcode: Data: 0.02MB + Index: 0.00MB wpq3_wd_fb_theme: Data: 0.02MB + Index: 0.00MB wpq3_woochimp_scheduled_events: Data: 0.00MB + Index: 0.00MB wpq3_wplc_chat_msgs: Data: 0.02MB + Index: 0.00MB wpq3_wplc_chat_sessions: Data: 0.02MB + Index: 0.00MB wpq3_wplc_offline_messages: Data: 0.02MB + Index: 0.00MB

Post Type Counts

attachment: 5284 blocks: 23 bne_testimonials_sg: 1 custom_css: 1 extra_product_tab: 2 featured_item: 8 mc4wp-form: 1 nav_menu_item: 15 page: 25 pos_temp_register_or: 1 post: 9 product: 3368 product_variation: 5066 revision: 8 sg_optimizer_jobs: 5 shop_coupon: 1 shop_order: 48 shop_order_refund: 5 snp_popups: 1 wcst_trigger: 9 woocollections: 4 woocollitems: 10 wpcf7_contact_form: 9

Security

Secure connection (HTTPS): ✔ Hide errors from visitors: ✔

Active Plugins (21)

ManageWP - Worker: by ManageWP – 4.5.0 BNE Testimonials Pro: by Kerry Kline – 2.7.2 Actionable Google Analytics: by Tatvic – CC-V3-2.0 – Not tested with the active version of WooCommerce Contact Form 7: by Takayuki Miyoshi – 5.0.1 MailChimp for WordPress: by ibericode – 4.2.1 Nextend Social Login: by Nextendweb – 3.0.6 WooCommerce Product Filter: by Mihajlovic Nenad – 6.5.5 – Not tested with the active version of WooCommerce Redirection: by John Godley – 3.2 SG Optimiser: by SiteGround – 4.0.5 Squirrly SEO 2018 (Briefcase): by Squirrly SEO – 8.3.17 StopBadBots: by Bill Minozzi – 4.77 Transients Manager: by Pippin Williamson – 1.7.4 Woocomerce Brands Pro: by Proword – 4.3.1 – Not tested with the active version of WooCommerce Woocommerce Variations Table - Grid: by Spyros Vlachopoulos – 1.3.9 – Not tested with the active version of WooCommerce WooCommerce Extended Coupon Features: by Soft79 – 2.6.2 WooCommerce Composite Products: by SomewhereWarm – 3.13.7 – 3.13.8 is available WooCommerce Stacked Product Layout: by SomewhereWarm – 1.1.7 – Not tested with the active version of WooCommerce WooCommerce PayPal Express Checkout Gateway: by WooCommerce – 1.5.3 WooCommerce Pretty Emails: by MB Création – 1.8.6 – Not tested with the active version of WooCommerce WooCommerce: by Automattic – 3.3.5 WP Rocket: by WP Media – 3.0.4

Settings

API Enabled: ✔ Force SSL: – Currency: GBP (£) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: composite (composite) external (external) grouped (grouped) simple (simple) variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5)

WC Pages

Shop base: #63 - /shop/ Basket: #62 - /cart/ Checkout: #61 - /checkout/ My account: #60 - /my-account/ Terms and conditions: #10945 - /terms-conditions/

Theme

Name: Flatsome Child Version: 3.0 Author URL: Child Theme: ✔ Parent Theme Name: Flatsome Parent Theme Version: 3.5.3 Parent Theme Author URL: http://www.uxthemes.com/ WooCommerce Support: ✔

Templates

Overrides: flatsome/woocommerce/archive-product.php flatsome/woocommerce/cart/cart-empty.php flatsome/woocommerce/cart/cart.php flatsome/woocommerce/checkout/form-checkout.php flatsome/woocommerce/checkout/form-coupon.php flatsome/woocommerce/checkout/thankyou.php flatsome/woocommerce/content-product.php flatsome/woocommerce/content-product_cat.php flatsome/woocommerce/content-single-product.php flatsome-child/woocommerce/content-widget-product.php /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/admin-cancelled-order.php version 2.3.0 is out of date. The core version is 2.5.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/admin-failed-order.php /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/admin-new-order.php version 2.0.0 is out of date. The core version is 2.5.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/customer-completed-order.php version 1.6.4 is out of date. The core version is 2.5.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/customer-invoice.php version 2.2.0 is out of date. The core version is 3.3.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/customer-new-account.php /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/customer-note.php version 1.6.4 is out of date. The core version is 2.5.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/customer-on-hold-order.php version - is out of date. The core version is 2.5.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/customer-processing-order.php version 1.6.4 is out of date. The core version is 2.5.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/customer-refunded-order.php version 2.4.0 is out of date. The core version is 2.5.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/customer-reset-password.php /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/email-addresses.php version 2.2.0 is out of date. The core version is 3.2.1 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/email-customer-details.php /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/email-footer.php version 2.0.0 is out of date. The core version is 2.3.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails//emails/themes/email-header-centered.php version 1.0 is out of date. The core version is 2.4.0 /home/globet47/public_html/robbostackle.com/wp-content/plugins/woocommerce-pretty-emails/emails/email-order-items.php version 2.1.2 is out of date. The core version is 3.2.0 flatsome/woocommerce/global/breadcrumb.php flatsome/woocommerce/global/quantity-input.php flatsome/woocommerce/global/wrapper-end.php flatsome/woocommerce/global/wrapper-start.php flatsome/woocommerce/loop/loop-end.php flatsome/woocommerce/loop/loop-start.php flatsome/woocommerce/loop/pagination.php flatsome/woocommerce/loop/result-count.php flatsome/woocommerce/loop/sale-flash.php flatsome/woocommerce/myaccount/form-login.php flatsome/woocommerce/myaccount/navigation.php flatsome/woocommerce/notices/error.php flatsome/woocommerce/notices/notice.php flatsome/woocommerce/notices/success.php flatsome/woocommerce/product-searchform.php flatsome/woocommerce/single-product/photoswipe.php flatsome/woocommerce/single-product/price.php flatsome/woocommerce/single-product/product-image.php flatsome/woocommerce/single-product/product-thumbnails.php flatsome/woocommerce/single-product/related.php flatsome/woocommerce/single-product/review.php flatsome/woocommerce/single-product/sale-flash.php flatsome/woocommerce/single-product/share.php flatsome/woocommerce/single-product/short-description.php flatsome/woocommerce/single-product/tabs/tabs.php flatsome/woocommerce/single-product/title.php flatsome-child/woocommerce/single-product/up-sells.php flatsome/woocommerce/single-product-reviews.php flatsome/woocommerce/single-product.php

Outdated Templates: ❌Learn how to update `

achadee commented 6 years ago

SOLVED:

Plugin conflict: Stop-Bad-Bots

blocking specific user agents