17種加速WooCommerce商店的強大方法(2020終極指南)

對於電子商務網站來說,速度就是金錢。您的網站載入速度越快,購物體驗就越好。更好的用戶體驗可以提高SEO,增加ROI和提高客戶滿意度。這最終導致更大的收入和利潤。

如今,購物者希望獲得高解析度的圖像和視頻,實時聊天,用戶評論,實時庫存,個性化以及許多其他動態工具。

在線購物者的關注範圍很短。因此,如果您沒有正確執行這些功能,那麼他們期望能夠更快,更流暢地進行購買的所有功能,都會使您的電子商務網站變慢。

只需移至Kinsta,即可將WordPress網站的速度提高200%。
        
          今天免費遷移

WooCommerce是世界上最受歡迎的電子商務平台,可以根據您的要求免費使用和調整。

WooCommerce引領電子商務包

WooCommerce引領電子商務包(圖片來源:BuiltWith)

迄今為止,WooCommerce已下載超過8800萬次。截至目前,已有500萬個網站在使用它。

WooCommerce插件下載和使用情況統計

WooCommerce插件下載和使用情況統計

與其他流行的購物平台不同,如果您使用WooCommerce,則無需向WooCommerce支付一定比例的收入。但是,與運營WooCommerce支持的商店有一些間接費用。

但是有一個陷阱!由於WooCommerce在有限的支持下是免費的,因此您有責任將其保持在最佳狀態。好消息是,如果您知道自己在做什麼,就很容易護理它!

想學習如何可靠地加速您的WooCommerce網站嗎?

本指南適合您!

為什麼速度對於在線商店很重要

第一印象很重要,速度是用戶對您的網站的第一印象。在Google的一項研究中,如果載入時間超過3秒,則有53%的移動用戶會離開該網站。

Google在美國的平均網站速度指數

最佳做法是3秒(圖片來源:與Google一起思考)

「 2秒是電子商務網站可接受性的門檻。在Google,我們的目標是不到半秒鐘。」
– Maile Ohye,Google技術主管

在另一項全球研究中,80%的用戶表示,他們發現載入緩慢的網站比暫時關閉的網站更令人沮喪。該研究還發現,如果網站載入速度太慢,則有73%的用戶會切換到競爭對手的網站。

頁面響應時間即使延遲100毫秒也可能會損害用戶體驗和在線收入。根據Akamai的說法,延遲100毫秒會對轉化率產生7%的影響,而延遲2秒則會影響轉化率高達103%。

如果您的網站每天產生1000美元的收入,那麼頁面載入時間的延遲100毫秒可能會使您每年損失25,550美元的銷售損失。

業務越大,下跌幅度越大。例如,亞馬遜預計,如果其頁面載入時間僅降低一秒,則每年將造成16億美元的收入損失。

Google的頁面載入時間與跳出率圖表

頁面載入時間至關重要(圖片來源:Google思考)

以上數據表明,如果您的網站載入需要6秒鐘或更長時間,那麼失去的用戶數量是網站載入時間少於3秒鐘的用戶數量的兩倍。

除了用戶體驗之外,您網站的速度還會影響SEO。網站的速度和性能是Google網站排名演算法的主要因素。

Google已將其搜索結果中超過50%的頁面轉向移動優先索引。儘管如此,HTTPArchive.org的數據表明,運行WordPress的移動網站的平均載入時間在去年有所惡化。

HTTPArchive.org上的WordPress網站性能統計信息

頂級WordPress網站的表現如何(圖片來源:HTTPArchive.org)

在高峰時段(例如網路星期一和黑色星期五),保持網站儘快運行就顯得尤為重要。隨著報價的不斷湧現,確保購物者不會放棄您的網站對於完成銷售至關重要。

有了這些統計數據,加快WooCommerce商店的銷售可以使您在競爭中佔據重要優勢。

速度決定一切:100毫秒的延遲會影響7%的轉換率,而2秒鐘的延遲則會使轉換率降低103%。了解如何加快WooCommerce商店和銷售的速度! ??

點擊鳴叫

測量WooCommerce商店的速度

無法衡量的東西,無法改善!

既然您已經了解了為什麼速度對WooCommerce商店很重要,那麼該學習如何衡量速度了。當您嘗試加快WordPress網站的速度時,了解如何評估改進至關重要。

網站速度測試是測試WooCommerce商店響應能力的理想工具。但是,如果您沒有正確執行此操作,則更改後,您的網站可能會變慢,但速度會更快。

Pingdom工具示例速度測試報告

網站速度測試報告(圖片來源:Pingdom)

我建議您開始使用以下網站速度測試工具之一:WebPagetest,Pingdom,Google PageSpeed Insights或GTMetrix。

您還可以使用免費的WordPress插件Query Monitor來確定性能不佳的主題,插件和功能。它可以幫助您調試低效的資料庫查詢、,腫的功能,PHP錯誤,HTTP API調用等。

沒有任何一種速度測試工具是完美的,但是選擇一個並堅持下去。您稍後可以嘗試其他選擇。

Google網站管理員趨勢分析師Gary Illyes的推文

Google網站管理員趨勢分析師Gary Illyes

實際效果與預期效果之間存在差異。用戶體驗比為站點提供動力的技術嚮導更為重要。

因此,請使用下面提到的技術來改善您網站的整體用戶體驗,而不僅僅是獲得較高的得分。

如何加快WooCommerce

速度測試報告將為您提供可行的計劃,以優化速度較慢的WooCommerce網站。激動嗎讓我們開始吧!

1.優化WooCommerce設置以提高性能

讓我們從優化WooCommerce設置入手。

首先,更改您的登錄頁面URL。默認情況下,每個WordPress網站的登錄URL為domain.com/wp-admin/。儘管這很容易記住,但是卻帶來了一個主要問題:包括機器人和黑客在內的所有人都知道這一點。

將您的登錄URL更改為唯一的內容可以保護您免受惡意行為者的暴力攻擊。它還可以幫助您解決速率受限的HTTP錯誤,例如429個請求過多。

WPS隱藏登錄和重命名wp-login.php等免費插件使此任務變得異常簡單。

如果您的電子商務網站也託管博客,則可以限制博客源中的帖子數量。 WordPress默認將此限制設置為10個帖子,但是您可以設置一個較低的限制。

儘管這似乎微不足道,但是如果您運行一個流量很高的博客,則可以節省性能(這是增加網站訪問量的方法)。您可以在WordPress儀錶板→設置→閱讀下找到此選項。

WordPress設置以限制發布修訂的數量

限制博客供稿中的帖子數量

接下來,在您的網站上禁用pingbacking。它們通常會產生毫無價值的垃圾郵件。您的網站生成的查詢越少越好。

優化WordPress討論設置

優化討論設置

如果您在帖子或頁面上有很多用戶評論,則WordPress還為您提供了將其分成較小塊的選項。同樣的設置適用於細分產品頁面上的評論。

將此數字保持在10到20之間,以優化您的產品頁面載入時間。

如果您不希望在商店中購買商品評論,可以在WooCommerce→設置下禁用商品評論。這將幫助您加快網站速度,因為它避免了載入一些腳本和小部件。

在WooCommerce設置中禁用產品評論

如果不需要,請禁用產品評論

最後,從您的網站中刪除所有不必要/過時的主題和插件。您安裝的主題和插件越少,維護它們和解決性能問題就越容易。

2.獲得快速的WooCommerce主題

使用正確的WooCommerce主題很重要。那裡有數十萬個主題,因此,確定最適合您的主題總是一個挑戰。

WordPress.org上的精選主題

WordPress.org上的精選主題

具有驚人內置功能的精美主題在紙上聽起來不錯,但在實際使用中可能會失敗。對於電子商務網站,您需要確保其與WooCommerce完全兼容。

使用過濾器在wp.org上智能搜索主題

篩選您的電子商務主題搜索

WP Rocket測試了許多流行的WooCommerce主題以提高速度,並得出以下結果。

WooCommerce主題大小和WP Rocket的請求報告

選擇一個快速的WooCommerce主題(圖片來源:WP Rocket)

WordPress加速文章中建議,Astra,OceanWP和GeneratePress也是Kinsta的最愛。它們是超快速,輕量級的WordPress主題。

與諸如Elementor或Beaver Builder之類的頁面構建器配對時,它們可以幫助您創建幾乎所有站點。

選擇一個快速的WooCommerce主題(圖片來源:WP Rocket)

店面是WooCommerce的官方主題

店面是WooCommerce提供的免費主題,而Shoptimizer,Divi和WoondrShop是高級主題。由於這些主題是為運行電子商務網站而構建的,因此無需安裝第三方插件即可獲得所需的所有功能。

如果您的預算不足,最好從免費主題開始,然後再升級為高級解決方案。

我建議留下頁面構建者以減少膨脹。相反,請選擇支持WordPress的塊編輯器Gutenberg的主題。

要確定主題,建議您列出在線商店中所需的所有功能。然後選擇涵蓋您大多數功能要求的主題。這將幫助您減少對腫的多用途主題和第三方插件的依賴。

這將我們帶入下一個建議。

3.輕鬆使用插件和WooCommerce擴展

WordPress的存儲庫中有54,000多個免費插件。野外還有更多高級插件。因此,很容易被帶走並安裝數十個。

wp.​​org上可用的插件的屏幕截圖

幾乎所有東西都有一個插件

許多流行的插件,尤其是與性能和安全性相關的插件,在某些託管環境中無法正常運行。

如果您難以決定要安裝哪個插件,請瀏覽Kinsta精選的最佳WordPress插件列表,以了解各種用途。從SEO到圖像壓縮,您一定會在其中找到一些寶石。

WooCommerce功能可以通過其廣泛的免費和高級WooCommerce擴展進行擴展。它們的工作方式與插件相同。

WooCommerce擴展商店頁面

WooCommerce擴展程序增強了商店的功能

與通常的看法相反,您安裝的插件數量並不總是會導致性能問題。但這隻有在使用最佳編碼實踐構建插件的情況下才成立。

當安裝的每個插件太多時,審核它們會帶來麻煩。考慮到您具有全面審核這些技能和專業知識的能力。

一些插件甚至與其他插件產生衝突。當您的站點上有數十個插件時,發生插件衝突的可能性呈指數級增長。

因此,請注意所安裝的插件和WooCommerce擴展的類型。

4.增加WordPress內存限制

WordPress默認為PHP分配32 MB內存。如果遇到任何麻煩,它將自動嘗試將此限制增加到40 MB(對於單個站點)或64 MB(對於多站點)。

在大多數情況下,此內存限制對於WooCommerce網站而言是不夠的。您甚至可能在儀錶板上收到錯誤消息,例如:

「允許的內存大小為xxxxxx位元組已用盡」

建議將此限制增加到256 MB。在編輯文件之前,請務必對其進行備份。萬一出了問題,可以用原始文件替換已編輯的文件。

信息

Kinsta的所有計劃都將默認內存限制設置為256 MB。如果您的網站由我們託管,則您不會遇到任何與內存相關的問題。詳細了解我們的免費遷移。

5.壓縮圖像並優化投放

圖片占任何網站頁面大小的大部分,對於電子商務網站而言更是如此。 WooCommerce網站上裝有產品圖片和橫幅。

如果您沒有針對圖像的大小和投放進行優化,它們可以使您的網站爬行

HTTPArchive跟蹤許多流行網頁的大小和數量。以下是其2020年WordPress網站狀態的直觀表示:

根據HTTPArchive.org,2020年WordPress頁面的中位重量

圖像是大量資源

儘管視頻是比圖片更多的資源,但在大多數情況下,視頻是按需載入的。因此,它們對感覺到的頁面載入速度的影響不如圖像影響大。

根據HTTP存檔的圖像狀態報告,您可以通過延遲載入隱藏的和屏幕外的圖像來節省每頁545 KB。

通過將JPEG壓縮級別設置為85或更低,可以進一步節省每頁40.3 KB。該指標直接來自Google的移動網站速度測試工具Lighthouse。

請遵循以下5條規則來為您的WooCommerce商店(以及一般而言的網路)優化圖像:

  1. 為圖像選擇正確的格式(JPEG,PNG,SVG,WebP)。
  2. 使用正確的工具有效地壓縮圖像。
  3. 使用響應式圖像優化各種設備的交付。
  4. 延遲載入屏幕外和隱藏圖像。
  5. 將圖像傳送卸載到快速CDN。

WooCommerce 3.3引入了圖像大小改進功能,例如即時調整縮略圖大小,模糊圖像修復和調整背景縮略圖大小。所有這些功能使使用諸如WooCommerce相關圖像的重新生成縮略圖之類的插件變得多餘。

通過WordPress Customizer自定義WooCommerce的產品圖片

自定義WooCommerce的產品圖片(圖片來源:WooCommerce)

如果您是全新安裝,則可以先壓縮圖像,然後再將其上傳到您的網站。以下是一些頂級在線圖像壓縮建議:

  • 壓縮器
  • Squoosh.app
  • Shrinkme.app
  • 海妖
  • 想像
  • TinyJPG |小小PNG

在Compressor.io上無損壓縮圖像

以最小的質量損失壓縮圖像(圖像源:Compressor.io)

您的網站上已經有很多圖片了嗎?然後,您可以使用WordPress插件自動進行圖像優化。以下是根據我的經驗始終表現最好的遊戲:

  • 短像素
  • 想像一下
  • 重新貼上
  • 擎天柱

這些插件中的大多數還可以啟用圖像的延遲載入。 WordPress核心團隊計劃將延遲載入圖像添加為內置功能。這將利用新的HTML載入屬性 標籤。

不過,關於圖像優化的最後一件事。盡量避免使用圖片壓縮插件,尤其是那些使用伺服器資源來壓縮圖片的插件。

而是,使用將圖像壓縮任務卸載到外部伺服器的服務。或者更好的方法是,在將圖像上傳到您的網站之前,調整其大小並壓縮。

對於深入的教程,Kinsta關於網路和性能的圖像優化的文章是入門的重要資源。

6.通過CDN交付靜態資源

內容交付網路(CDN)是一組策略性地位於世界各地的伺服器。這些伺服器位置稱為存在點(PoP)。

CDN的主要功能是緩存和傳遞靜態資源,例如圖像,JavaScript,CSS等。功能更強大的CDN也可以承載和傳遞動態內容,例如音頻和視頻。

即使您的網站運行在全球最快的伺服器上,它仍然受到地理位置的限制。 WordPress CDN可以縮短單個用戶與網站資源之間的距離,從而減少網路延遲和縮短到第一個位元組(TTFB)的時間。

金斯塔CDN

Kinsta CDN及其POP突出顯示

根據請求的來源,它會自動分配最近的CDN PoP來傳遞緩存的資源。結果是更快的網站和更好的用戶體驗。

例如,如果您的WooCommerce商店託管在美國的伺服器上,而印度的用戶試圖打開您的網站,則CDN將從最近的PoP服務該網站的資產。這將來自印度班加羅爾。

信息圖,顯示CDN如何幫助更快地提供靜態內容

CDN非常適合傳遞靜態內容(圖片來源:Seobility)

通常,PoP的數量越多,它們在全球範圍內的傳播範圍越廣,您的網站對用戶的速度就越快。

Kinsta對CDN進行了測試,結果不言而喻。對於地理位置距離託管伺服器遠得多的用戶,使用CDN可以將站點載入時間減少50%以上。

除緩存外,許多CDN還包括其他性能增強功能,例如出色的動態圖像壓縮,HTTP / 2支持,熱鏈接保護和附加安全性。

對於更快的WooCommerce商店,我們建議您使用快速CDN。您可以簽出的一些流行CDN:

  • 雲耀斑
  • Sucuri CDN
  • Cloudways CDN
  • 棧路徑
  • KeyCDN(也支持Kinsta CDN)

7.刪除未使用的腳本和樣式表

大多數WordPress主題和插件會在您網站的所有頁面上載入腳本和樣式表。他們會載入這些資產,即使它們沒有在頁面上使用也是如此。

例如,Contact Form 7在每個頁面上載入其腳本和樣式表。它的形式只能在聯繫頁面上使用,但是資產會在所有頁面上載入。完全沒有必要!

從頁面中刪除這些未使用的資產將有助於您減少膨脹並加快頁面載入時間。 WooCommerce及其擴展程序(例如,智能優惠券和後續行動)容易受到此問題的影響。

例如,您無需在商店的首頁或商店頁面上載入與付款網關相關的腳本。您可以限制此類腳本僅在結帳頁面和訂單確認頁面上載入。同樣,從您的結帳頁面中刪除滑塊和輪播的腳本和樣式。

如果您想知道要消除的資產,請查看網站速度測試報告中的瀑布圖。它會帶給您有關正在載入的不必要資產的想法。

GTMetrix的瀑布圖示例

GTMetrix的瀑布圖

Chrome瀏覽器的DevTools下的「網路」標籤也是入門的好地方。它會為您提供有關網頁載入方式和載入方式的全面視圖。

Google Chrome瀏覽器的DevTools下的「網路」標籤

使用Google Chrome DevTools中的「網路」標籤

刪除頁面功能所不需要的腳本和樣式。首先,請優化您的首頁和登錄頁面,因為這是大多數用戶的首要切入點。

您可以使用wp_dequeue_script和wp_dequeue_style函數刪除不需要的腳本和樣式。一種簡單的方法是通過名為Asset CleanUp:Page Speed Booster的插件。

使用Asset CleanUp插件清理您的WordPress資產

清理您的WordPress資產

Asset CleanUp掃描所有將載入到頁面上的腳本和樣式表。您可以禁用頁面上未使用的內容。完成更改後,請測試頁面的正確設計和功能。

從帶有資產清理插件的頁面上卸載Stripe付款網關腳本

通過資產清理卸載Stripe付款網關腳本

插件的專業版可讓您設置資產的非同步或延遲屬性。應用此設置會將JavaScript從頁面的關鍵呈現路徑中刪除。它應該有助於改善您網站的頁面載入時間。

消除不必要的CSS和JS資產的另一個優點是您的網站將減少HTTP請求。

作為免費替代方案,您可以結合使用Autoptimize和Async JavaScript插件來獲得相同的結果。

8. HTTP / 2非常重要

如果我們幾年前寫這篇文章,我們將其標題為「減少HTTP請求的數量」。由於瀏覽器與網站進行通信的方式有了實質性的改進(反之亦然),因此現在不再需要這種優化。

HTTP 1.1是HTTP協議的第一個主要更新,並於1997年完成。它早於社交媒體,流服務,智能手機應用程序甚至WordPress。自那時以來,網路呈指數增長。

HTTP / 2是對HTTP 1.1協議的改進,並在2015年投入使用,以適應互聯網不斷增長的需求。它帶來了速度,效率和安全性方面的驚人改進。

HTTP 1.1。與HTTP / 2的主要優點

HTTP 1.1與HTTP / 2(圖片來源:Cloudflare)

HTTP / 2的性能提高是由於多種原因:

  • 在單個TCP連接上更好的多路復用和並行性。
  • 使用Huffman編碼演算法對標頭進行HPACK壓縮。
  • ALPN擴展可實現更快的加密。
  • 主動伺服器推送而不是等待請求。

所有這些爵士樂都構成了一個關鍵優勢:即使網站託管各種類型的資源,也可以使其載入速度更快。

通常,WooCommerce商店提供大量資源密集型資產,例如圖像,樣式表和腳本。此類站點將通過切換到HTTP / 2大大受益。

您可以使用KeyCDN的HTTP / 2測試工具來檢查您的站點是否配置為使用HTTP / 2。到目前為止,每個主流瀏覽器都支持HTTP / 2。您沒有理由不應該利用其巨大的性能優勢。

如果您的託管服務提供商尚不支持HTTP / 2,請開始尋找新的主機。 Kinsta在其所有伺服器和CDN上均支持HTTP / 2和TLS 1.3。

此外,HTTP / 3指日可待,旨在使網站載入速度更快。

9.緩存WooCommerce以加快速度

緩存是臨時存儲來自一個請求的資源(緩存),以便可以快速執行後續請求。緩存可以存儲在伺服器或用戶設備上。

這是加速WooCommerce商店的最簡單方法之一。這也是最重要的一項

Web緩存如何工作的信息圖

Web緩存如何工作

  1. 用戶通過他們的瀏覽器請求一個網站。例如,他們在瀏覽器中輸入www.kinsta.com。
  2. 然後,瀏覽器請求網頁(HTML文檔)顯示給用戶。 DNS伺服器會處理此請求,從而顯示主機伺服器的IP。
  3. 返回網頁由託管在網路伺服器上的應用程序(例如WordPress,Joomla等)處理。對於靜態網站,甚至可能不需要應用程序。
  4. 該應用程序運行腳本(例如PHP,JavaScript等),並且(5)查詢資料庫(例如MySQL,MongoDB等)以構建網頁。然後,它將網頁返回到瀏覽器,瀏覽器將其呈現並顯示給用戶。

如果一切正常,上述所有步驟最多應花費幾秒鐘的時間來執行。

但這只是一個用戶的一個請求。如果同時有成千上萬的用戶發出多個請求怎麼辦?這將給伺服器帶來巨大的負擔,最終導致網站速度變慢。

這是緩存的解決之道。它減少了生成頁面瀏覽量所需的工作量,從而減少了WordPress對PHP和資料庫的依賴。緩存使WordPress的執行速度幾乎與靜態網站一樣快,甚至不一樣。

Web緩存有2種主要類型,每種都有自己的子集:

  1. 伺服器端緩存
    • 位元組碼緩存(OPCache)
    • 對象緩存
    • 頁面緩存
    • CDN緩存
  2. 客戶端緩存
    • 瀏覽器緩存

緩存不僅可以使網站載入速度更快,還可以減少伺服器上的負載。 Kinsta關於WordPress緩存的深入文章是詳細解釋的好資源。

如果您的WooCommerce商店由Kinsta託管,則緩存將在伺服器級進行。因此,您無需使用緩存插件。

Kinsta配置緩存規則以與WooCommerce無縫協作。這樣可確保您的用戶順利進行結帳,而不會打ic。

遷移到Kinsta後改善WordPress載入時間的示例

遷移到Kinsta的新伺服器後,WordPress的載入時間

如果您的託管服務提供商沒有在伺服器級處理緩存,那麼您需要依靠第三方緩存插件來為您完成工作。雖然它們不是理想的解決方案,但總有總有沒有總比沒有好。

這是我對WordPress緩存插件的最佳建議:

  • WP火箭(高級版)

  • W3總緩存(免費)

  • 緩存啟動器(免費)

有關更多選項,請查看Kinsta在WordPress緩存插件上的帖子。

10.清理您的WooCommerce資料庫

資料庫是您所有網站數據的有組織的集合。在WooCommerce商店中,它包括:

  • 網站內容,例如產品頁面,類別,標籤,用戶數據,評論,網站範圍的設置,主題,插件等。

  • 交易數據,例如訂單明細,付款,庫存等。

每次用戶訪問您的商店時,他們都在請求您的網站內容,該內容大部分是靜態的,並且變化不大。但是,當他們下訂單時,他們是在發出動態請求。

如果您不優化商店的資料庫,則處理這些請求的時間可能太長。最終,伺服器響應時間慢會導致網站速度慢。因此,您必須通過刪除不必要的垃圾來清理和優化資料庫。

這是6種加快和微調WooCommerce資料庫的方法。

刪除舊版本

如果您的WooCommerce商店已經營業了一段時間,那麼其頁面,帖子和產品將充滿舊版本。現在該清理這些了。

最簡單的方法是通過WP-Sweep或WP Rocket等插件。

使用WP Rocket刪除舊的帖子修訂

使用WP Rocket刪除舊版本

如果您方便使用WP-CLI,則還可以通過SSH連接到伺服器並運行一些簡單的命令來完成此操作。這是您的操作方法。

限制存儲的修訂數量

您可以通過限制帖子和頁面的修訂數量來避免擁有多箇舊修訂。如果您傾向於經常更新網站內容,這將有助於您避免修改過時。

設置限制的簡單方法是將以下代碼片段添加到wp-config.php文件中。確保將其添加到定義ABSPATH的行之前。

define(’WP_POST_REVISIONS’,15);

在上面的代碼中,我將限制設置為15。您可以將其更改為任意數量的修訂版本,但請嘗試將其保持在15以下。

或者,您可以使用免費的插件(例如WP Revisions Control)來執行相同的操作。

使用WP Revisions Control插件來限制後期修訂的數量

使用WP版本控制設置版本數量

完全禁用修訂(如果不需要)

您可以完全從您的站點禁用修訂。您需要做的就是將以下代碼添加到wp-config.php文件中。和以前一樣,請確保將此代碼段添加到定義ABSPATH的行上方。

define(’WP_POST_REVISIONS’,false);

或者,您也可以使用免費的插件(例如「禁用後期修訂」)單擊一次。

在禁用修訂之前,建議您刪除仍然存在的所有舊修訂。這樣,您網站的資料庫將完全不受以後的修訂。

清理過期的瞬態

瞬態是使用自定義名稱和有效期限存儲的緩存數據。它們通常存儲在WordPress資料庫中的wp_options表下。

瞬態與選項相似,不同之處在於它們具有到期時間的附加屬性。它們對於存儲臨時數據(例如來自遠程API的響應或大型查詢)很有用。

WordPress Transients API定義了如何自動處理瞬態和刪除過期的瞬態。但是,事情並非總是按計划進行。

有時,損壞的瞬態緩存可能會創建幾乎一百萬個垃圾條目,而且看不到盡頭。客戶會話可能隨著時間的推移而增加,從而在資料庫表中創建了數千個不必要的行。在這種情況下,a腫的資料庫可能會使您的網站癱瘓。

免費的Delete Expired Transients插件是擺脫所有過期瞬變的簡便方法。

刪除過期的Transients插件面板屏幕

輕鬆刪除所有過期的瞬態

清理資料庫表

WooCommerce資料庫存儲了運行電子商務商店所需的一切。隨著數據在資料庫中的表中的添加,刪除和移動,它變得效率低下並最終存儲了許多對商店運行不重要的東西。

您需要通過清理資料庫表來清除這些不必要的數據。尤其是wp_options表很容易變得腫並損害資料庫性能。

phpMyAdmin下的WordPress資料庫中的wp_options表

WordPress資料庫中的wp_options表

資料庫整理是保持WordPress網站儘快運行的關鍵。

手動優化資料庫是一個耗時的過程。您可以使用免費的WP-Optimize插件來檢查哪些資料庫表中包含不必要的數據並刪除那些浪費的空間。它還可以檢索因數據碎片而丟失的存儲空間。

您可以安排WP-Optimize定期清理和優化資料庫。

禁用對資料庫徵稅的非關鍵功能

WooCommerce themes and plugins come with a lot of cool features that seem great from the outset but end up crumbling the database.

One such example is using 「Popular Products」 and 「Related Products」 plugins. These features can cause enormous sitewide queries, especially if you have many products. If you need these features, try to insert them manually into your pages. Plugins such as Advanced Custom Fields can help here immensely.

Kinsta's

Kinsta inserts its 『Related Content』 posts manually

Another example is image optimization plugins that compress images on the same server where the site is hosted, rather than do it externally. This ends up using a lot of your server』s resources.

Social Warfare plugin is known to be taxing on your server

Social Warfare plugin can tax the server resources

Also, stay away from plugins that add counters to your site. For example, adding the number of views/posts/comments beside a username. A lengthy discussion with multiple users involved will stress your database to crunch these numbers.

This advice holds true for using social counters too. Minimize the use of auto-generated counters to maximize database performance.

Like housekeeping, fine-tuning your WordPress database is an ongoing process.

Keeping this in mind, Kinsta has implemented an automated system to combat database performance issues. Based on your site』s needs, the automated system scans and fine-tunes your MySQL database once per week to ensure peak database performance. If the system detects something out of the ordinary that can』t be fixed automatically, it notifies the sysadmin team to take immediate action.

If your site is hosted somewhere else, here are a few database optimization plugins to make your job easier:

      • WP-Sweep
      • WP-Optimize
      • WP Clean Up Optimizer
      • Advanced Database Cleaner

Reminder: Always take a backup before editing your database or WordPress core files.

11. Optimize Your Store for Mobile-First Experience

As of January 2020, there are over 4 billion internet users in the world. There are almost as many mobile internet users. It』s expected to grow to 5+ billion by 2024.

Total number of Internet users in the world

There are billions of us (Image source: Statista)

Mobile devices overtook desktops in global website traffic in 2019, generating 52.6% of the total pageviews. In some countries such as India and Nigeria, mobile phones account for 70%+ of web page views.

Kinsta's mobile versus desktop traffic in Google Analytics

Mobile traffic from Google Analytics

According to a study involving 500+ million online shoppers across 37 countries, smartphones accounted for 65% of site visits and 46% of ecommerce orders.

A bar chart graph of conversion rate by devices

Mobile shopping has massive growth potential (Image source: Statista)

Surprisingly, the conversion rate for mobile phones is less than half that of desktops. There』s phenomenal room for growth here.

58% smartphone users are more likely to buy from mobile-optimized websites

Speed counts a lot for mobile shoppers (Image source: Think with Google)

You can start by making your WooCommerce store mobile-friendly. You can use Google』s Mobile Friendly Test tool to check whether your site passes the minimum mobile usability standards.

Google's Mobile Friendly Test tool

Google』s Mobile Friendly Test

The test will show you a snapshot of how your website looks on a mobile device. It』ll also list any mobile usability issues if it finds any.

The easiest way to make your WordPress website mobile-friendly is to use a responsive theme. All the themes mentioned earlier in this post are responsive out of the box and look great on mobile devices.

Mobile shoppers don』t enjoy scrolling endlessly. Hence, keep your store pages as lean as possible. Don』t overcrowd them with too much content.

If you have loads of products listed on your store, make it easier for your mobile shoppers to find them through search. You can install the WooCommerce Product Search plugin to help your customers find products swiftly with live product filters.

WooCommerce Product Search plugin screenshot

Simplify product search with filters (Image source: WooCommerce)

Finally, streamline the checkout experience for your online shoppers. The fewer the steps to place an order, the better the shopping experience. Here are a few WooCommerce extensions that can help you with this:

  • WooCommerce Social Login — Eliminates the need for time-consuming account creation or login process. Let your users log in with their social accounts such as Facebook, Twitter, Google, etc.

  • Variation Swatches and Photos — Say goodbye to annoying dropdown menus to select product variations. Instead, give your users easy-to-tap buttons for all your product options.

  • One Page Checkout — Don』t let your customers abandon your site that easily. Allow them to purchase what they want instantly with no extra steps. If you think guest checkout is a great fit for your store, then you can look into enabling it.

  • Checkout Field Editor — Add, remove or change fields from your checkout page. For instance, if you only sell digital products, you do not need to collect shipping addresses.

  • Bolt / Stripe / Amazon Pay / PayPal — Payments are the bane of mobile shopping experience. You can choose from different WooCommerce payment gateway extensions to make it easier to collect payments.

Bolt payment gateway extension for WooCommerce

Easy mobile checkouts with Bolt

Ultimately, mobile shopping is more than just about making a purchase. Many users use it primarily to look up product information and check/compare prices. Make your online store experience great for your users on their mobile devices.

12. Disable Get Refreshed Fragments AJAX Request

When a user makes any changes to their shopping cart, WooCommerce uses the Get Refreshed Fragments AJAX request to update the shopping cart contents dynamically. Refreshing the cart page without reloading it seems great from a user experience perspective.

But most times it slows down websites, mainly those hosted on shared servers. Plus, a lot of sites don』t end up using this feature.

Just to verify, I tested an up-to-date WooCommerce store on Pingdom Tools and here are the results:

Load time chart for WooCommerce's Get Refreshed Fragments Ajax request

That』s a lot of wait time for one request

Despite being just 1.1 KB in size, the wc-ajax=get_refreshed_fragments request takes 0.76 seconds to execute. If your site takes 3 seconds or less to load, that』s over 25% of the page load time. This test site is hosted on a cloud VPS, so you can imagine the load times on a cheaper hosting plan.

This post by WebNots covers the issue in greater detail. You can use the free Disable Cart Fragments or Disable Cart Fragments by Optimocha plugins to disable this taxing request.

If you disable this request, then it』s recommended enabling the option 『Redirect to the cart page after successful addition』 in your WooCommerce → Products settings panel.

WooCommerce Product settings panel to enable Redirect to Cart behavior

Remember to enable this setting afterward

Enabling this behavior will ensure that the user is redirected to the Cart page after adding a product to their cart.

Optimizing WooCommerce Admin Panel

Speed isn』t an important factor for only your store』s frontend. A snappy backend is just as crucial to manage your store with ease and make quick changes whenever needed.

Working efficiently on your WooCommerce admin panel is the key to being productive. It also frees up your time to do more essential stuff for your WooCommerce store』s success, like online marketing.

Below are a few ways to fix a slow WooCommerce dashboard.

Frontend Optimizations First, Backend Optimizations Second

Does the problem only occur with the WordPress admin dashboard and not the whole website? If it』s the latter, then apply all the optimizations listed earlier first.

為什麼? Because in most cases, making your WooCommerce store load faster on the frontend will optimize the backend too. We can attribute this to freeing up resources on your server.

If your admin dashboard lags even after optimizing the frontend, then carry on to the following suggestions.

13. Remove Bloat and Update Everything Regularly

Make sure to update WordPress, WooCommerce, plugins, extensions, and the theme frequently. If a theme or plugin is no longer supported by its developers, then it』s time to consider ditching them.

Likewise, if a theme/plugin adds unnecessary bloat to your dashboard, start looking for better alternatives. For instance, you might want to consider alternatives to plugins that serve aggressive ads in your dashboard.

Yoast SEO plugin Big Banner Animated Ad inside the WordPress dashboard

Example of banner in WordPress admin

This issue is so prevalent that there are plugins solely dedicated to removing bloat from some of the most popular WordPress plugins.

14. Disable Object and Database Cache

Caching plugins are a great way to speed up your WordPress site. However, if not configured properly, they can lead to unexpected results. That includes slowing down your backend.

For instance, W3 Total Cache is one of the most popular caching plugins for WordPress. It』s free, supports plenty of caching options, does JS and CSS minification, integrates with a CDN, and is used by 1+ million websites.

WordPress W3 Total Cache General Settings Panel

Cache options in W3 Total Cache

W3 Total Cache features the following cache options:

  • Page Cache.
  • Opcode Cache.
  • Database Cache.
  • Object Cache.
  • Browser Cache.
  • Fragment Cache.

Having a lot of options is confusing, especially to beginners who don』t understand what each type of caching does.

Object and database caching speed up the website by reducing the number of database queries, but they do so at the cost of offloading the work to the server』s memory.

Ideally, this shouldn』t pose a problem if your hosting server is smart or powerful enough. For instance, if your WordPress site is hosted with Kinsta, you don』t need to worry about caching as it』s already implemented at the server level.

Unfortunately, that』s not the case with every hosting provider.

In that scenario, you need to depend on a third-party caching plugin such as W3 Total Cache. Its simple settings make it super easy to enable all types of cache with just a single click.

In the W3 Total Cache → General Settings panel, disable object cache and/or database cache. Then check whether you see any improvements in your admin panel』s responsiveness.

W3 Total Cache Disable Database and Object Cache

Disable Database and Object Cache

Experimenting with the cache isn』t as simple as ticking or unpicking options in your plugin settings. You should also check whether your site works properly after making the changes and flushing your old cache.

15. Remove Plugins with High Resource Usage

Some WordPress plugins are a great resource hog on your web server. They end up using most of your server』s CPU and RAM.

You can use the free Query Monitor plugin to find the troublesome plugins. It』ll show you all the scripts, styles, and HTTP API calls that are being loaded by your website, along with their size and loading time. Look out for the ones that have the most number of requests and the slowest load times.

On the test site below, the Classic Editor plugin loads the slowest on the admin side. Other plugins like Loginizer, All-in-One WP Migration, and WP Bakery (formerly Visual Composer) also show up as potential bloat.

Query Monitor plugin dashboard to find the slowest plugins

Query Monitor helps you troubleshoot performance issues

I found that the migration and Classic Editor plugins are unnecessary. Removing these two plugins fixed the admin speed considerably.

WooCommerce stores with an international audience use translation plugins like WPML to serve the site dynamically in multiple languages. It』s a great plugin with a lot of features, but it can also slow down your admin backend considerably.

You can gain some performance advantage by switching to a lean translation plugin such as Polylang. It doesn』t have as many features but works great for most use cases.

Plugins that have a lot of ongoing processes/scans will slow your WordPress backend. Some examples include sitemap generators, analytics graphs and charts, page builders, and chat plugins.

Info

If you install Query Monitor, remember to uninstall it when done as it uses a lot of server resources to perform the scans.

16. Use Proper CDN Settings for WordPress

CDN helps to serve your WooCommerce store at lightning speed to users all around the world. It does this by saving a snapshot of your site』s resources and delivering them from the nearest server to the user.

Most CDNs disable caching on the WordPress backend by default. But some CDNs don』t, and this can slow down your store』s admin panel drastically. In such a case, you need to exclude your admin dashboard from the CDN』s cache to improve its performance.

If you』re using Cloudflare, you can set up a Page Rule to disable Cloudflare features on WordPress admin pages. Here』s how to do that:

  1. Go to the Page Rules section under your Cloudflare dashboard.
  2. Add *example.com/wp-admin/* in the URL field.
  3. In the settings fields, choose Cache Level and Bypass options.
  4. You can also add extra settings such as Disable Performance and Disable Security (not recommended). These settings are optional.
  5. Then click Save and Deploy.

Cloudflare Page Rules section for disabling cache on admin panel WordPress

Cloudflare Page Rules to bypass WordPress admin

It should take around 3 minutes for the settings to take effect.

If you』re using KeyCDN, then you can use their WordPress Cache Enabler Plugin to do the same. For other CDNs, please reach out to their support to sort this out.

17. Streamline WordPress Heartbeat API

The WordPress Heartbeat API enables near-real-time updates by maintaining a regular connection between your browser and your server. The API sends requests to the server every 15-60 seconds and then triggers events (or callbacks) upon receiving data.

It allows some amazing features such as autosaving posts, locking posts, and login expiration warnings. However, when you』re logged in as an admin, sending a few requests to the server every minute can slow down your admin panel.

WP Rocket』s free Heartbeat Control plugin allows you to manage the frequency of these API requests on the dashboard, frontend, and post editor. It even gives you the option to disable the API altogether.

WordPress Heartbeat Control plugin panel

Modify or disable WordPress Heartbeat API

Start by increasing the frequency of time. If that doesn』t fix your WooCommerce backend』s speed issues, consider disabling the heartbeat API.

If applying all the above optimizations still doesn』t fix your WooCommerce store』s speed issues, then…

WooCommerce Speed Starts with Quality Hosting

Just like running a car with flat tires, no matter how many optimizations you make, your site won』t get any faster if it』s hosted on a lousy server. A significant portion of your site』s performance depends on the quality of your hosting.

There are different types of hosting for WordPress sites which fall under two main category: Managed and Unmanaged. The first is perfect for most users, as the hosting provider handles all the server optimizations for WordPress. The latter is better suited for technically proficient users who can tweak and manage the server on their own.

For a WooCommerce website, go for Managed WordPress Hosting. Keep in mind that managed hosting tends to be more expensive than unmanaged hosting.

You can choose from 4 major types of Managed WordPress Hosting. Each comes with its own pros and cons, so select the one that aligns with your budget and goals. I』ve compared them in the infographic below for various features.

An infographic of 4 main types of Managed WordPress hosting

4 main types of Managed WordPress Hosting

Each type of hosting can be offered under multiple plans at different price points. So, when scouting for a hosting within your budget, look at the features offered to decide whether it fulfills your requirements.

WooCommerce sites are incredibly dynamic by nature. They generate a lot of data and requests that cannot be cached.

For instance, the checkout page is unique for each user and cannot be served from a cache. As a result, the server needs to be robust enough to run your site smoothly, even if your site attracts low traffic.

The recommended features you should look out for when deciding on a WooCommerce hosting plan are:

  • Server-level caching with WooCommerce-specific cache rules in place.
  • 2 to 4 PHP workers to handle WooCommerce』s uncached requests without timing them out.
  • WordPress memory limit of 128 MB or more.
  • Auto-scaling infrastructure to handle surges in traffic and load.

  • Automatic daily backups (hourly preferred) to ensure that your ecommerce data is safe and secure.

  • A fully secure hosting platform with security features such as regular malware scans, GeoIP and abusive IPs blocking, free SSL, SFTP, SSH, HTTP/2, and TLS 1.3.
  • Nginx or LiteSpeed web server software.

  • Support for developer-friendly features: PHP 7.4, LDX containers, WP-CLI, GitHub, MariaDB, Staging environments, etc.
  • High uptime with data centers spread all across the world. Go for the one that has servers close to where your target audience is.
  • Support for external CDNs such as Cloudflare and Amazon CloudFront.
  • A reliable 24/7 support team to resolve any issues quickly.
  • Great user reviews and a stellar track record.

With these requirements in mind, you can safely eliminate Shared Hosting.

A Virtual Private Server (VPS) is like shared hosting, except you have a virtual space in a shared server dedicated solely to you. If you』re on a strict budget, you can get started with a mid-range VPS plan. However, if your site attracts more traffic, then you』ll have to upgrade soon.

This leaves us with Cloud Hosting and Dedicated Server options. Both are great for WooCommerce sites if they fulfill your requirements.

The prices for dedicated server plans are towards the higher side as compared to cloud hosting plans, which can range from ~$50/month to thousands of dollars per month.

Kinsta』s business cloud hosting plans check off all the recommended WooCommerce requirements. Its container-based hosting is perfect for WooCommerce as it scales automatically to handle sudden traffic and load surges.

If you want to extend the features further, Kinsta offers add-ons such as Cloudflare Railgun, Elasticsearch, Redis, Extra backups, Nginx reverse proxy, and more.

Below is an example of performance gains after Kinsta migrated an ecommerce site to Google Cloud Platform』s new Compute-Optimized VMs (C2).

Performance increase chart after Kinsta upgraded an ecommerce site to GCP's new C2 platform

Massive performance benefits after migration

From ~665 ms to ~500 ms, that』s a whopping ~25% increase in performance!

If you』re spending a considerable amount of money on marketing, you』re pushing away all your leads if your site is slow.

Ultimately, you』re better off spending a few extra dollars every month on quality hosting, rather than spending hours pulling out your hair and wondering why your site still has a high bounce rate.

If your site is generating $1k/day, a 100-millisecond delay might cost you $25k in lost sales annually. Scary, uh??? Stop losing money and read this guide on speeding up WooCommerce!

點擊鳴叫

Summary

Time is literally money for an ecommerce site. A fast WooCommerce store boosts user experience, SEO, revenue, and ROI.

While you don』t have to follow all the speed optimization tips listed in this post, I recommend you to go through all of them. This will help you identify any bottlenecks in your site. No one likes to wait for a site to load. Let』s speed up WooCommerce!

If you enjoyed this article, then you’ll love Kinsta』s WordPress hosting platform. Turbocharge your website and get 24/7 support from our veteran WordPress team. Our Google Cloud powered infrastructure focuses on auto-scaling, performance, and security. Let us show you the Kinsta difference! Check out our plans

相關文章