doumi1884 2017-06-15 10:13
浏览 51
已采纳

Woocommerce SPA嵌入在woocommerce网站上

I am building a tool (SPA) which helps customers decide which product is best for them. The tool also allows them to make a purchase.

Built using vue.js, and originally intended to be embedded within a page on a Shopify store, I have been asked to replace Shopify with Woocommerce.

I've not used woocommerce in this way before (I typically use it as is, and make changes to templates via action hooks and templates).

The SPA will be embedded within a page on the woocommerce site. I see that woocommerce has an API, with various endpoints from which I can retrieve data, and post when a customer wishes to purchase.

Should I use this api, or, should I make woocommerce templates which return json? It seems sensible to use the API as its useful for this type of thing.

If using the API, will I need to authenticate against it using oauth etc? The SPA will exist within a page of the woocommerce site, within the same domain as the API.

Sorry, this is probably a poor question - I just need a nudge in the right direction. Does anyone have any pointers on the best way I should proceed? Thanks, Rob

  • 写回答

1条回答 默认 最新

  • doulian5857 2018-02-10 23:36
    关注

    You can take a look at WooCommerce REST API, which uses Wordpress REST API. Then you can use the builtin Backbone Client with wp_enqueue_script('wp-api'); and make use of the Backbone.Model and Collection to handle CRUD operations or other JavaScript client libraries.
    You can define your own REST Endpoints.
    I think this what you are looking for.
    And there is of course the old friend AJAX ;-)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果