{"id":17960183,"date":"2024-08-18T10:42:28","date_gmt":"2024-08-18T10:42:28","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/works-fine-but-slowly\/"},"modified":"2024-08-18T10:42:28","modified_gmt":"2024-08-18T10:42:28","slug":"works-fine-but-slowly","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/works-fine-but-slowly\/","title":{"rendered":"Works fine, but slowly"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">So far the calculations appear to be correct for me, but this plugin slows down your website as the Printify API is called multiple times on the basket and checkout pages.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;d rather not go through the faff of coding against the Printify API from scratch, so I&#8217;ve customised the get_shipping_rates function in the Printify_Shipping_API class for the plugin on my site for now. Nothing fancy &#8211; I&#8217;m saving the Printify API results in PHP session after it&#8217;s called for the first time and using that until the request (basket contents &amp; shipping address) changes, but it dramatically reduces basket &amp; checkout page load time. Session seemed more appropriate than object\/transient storage as I imagine there won&#8217;t be a lot of crossover with people having a similar shipping address buying identical items within a short period of time. I&#8217;ve shared the code with Printify via my support ticket and suggested they implement something like this in the plugin. In the meantime, I&#8217;ve disabled auto updates for the plugin on my site and will wait to see what happens in future versions. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Happy to share my code if anyone wants it, but comes with no warranty!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks,<br \/>Sam<\/p>\n","protected":false},"template":"","class_list":["post-17960183","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17960183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17960183\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=17960183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}