Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider: WooCommerce #172

Closed
okbel opened this issue Jan 20, 2021 · 38 comments
Closed

Provider: WooCommerce #172

okbel opened this issue Jan 20, 2021 · 38 comments
Labels
enhancement New feature or request in-progress

Comments

@okbel
Copy link
Contributor

okbel commented Jan 20, 2021

ecommerce provider: https://woocommerce.com/
Assigned to: @mohammadou1

@joedooley
Copy link

joedooley commented Jan 31, 2021

Hey @mohammadou1 / @okbel. I was wondering if you guys wanted some help with this ticket? Is there anything I could work on?

@mohammadou1
Copy link
Contributor

Hi @joedooley, I would be pleased if you took a look at the repo and saw what you can PR to it,

https://github.com/mohammadou1/commerce/tree/feature/woocommerce

in GraphQL perspective, its almost done and will pushed soon,

@joedooley
Copy link

joedooley commented Jan 31, 2021

Hi @mohammadou1, Looks like your off to a solid start!

I'm comfortable working on whatever would be most helpful. With that said... it would take me a little while to wrap my head around the data layer to create the gql queries/mutations for the server calls to the WC api endpoints.

Is there something that's a little higher level that I could work on at this point in time? For example, begin working on the checkout flow? That way once the cart api is ready to go. We'll be able to test the entire flow from start to finish?

By checkout flow... I am referring to the cart page, checkout page, thank you page, etc...

Is there any direction/mockups/ideas for self hosted checkout flows? If this is being discussed somewhere, would you mind sharing a link?

@dgroch
Copy link

dgroch commented Mar 13, 2021

@okbel @joedooley @mohammadou1 I’m looking at contributing to this project so we can migrate our large woocommerce site to NextJs.

On the graphql front, am I correct in thinking BigCommerce / Shopify offer graphql APIs which are consumed by the nextjs app whereas with woocommerce we need to develop our own resolvers (or find a plug-in)?

And the reason it’s preferred to adopt graphql rather than consume the standard woocommerce rest api is speed?

Has thought been given to the Cart API and user authentication?

Other headless woocommerce implementations I have researched used CoCart plugin because woocommerce cart API is not public.

Also what is the situation with user authentication? From what I’ve read it seems the core Wordpress REST API is limited. You’d need to have a plugin like https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api to be able to issue auth tokens.

@mohammadou1
Copy link
Contributor

@okbel @joedooley @mohammadou1 I’m looking at contributing to this project so we can migrate our large woocommerce site to NextJs.

On the graphql front, am I correct in thinking BigCommerce / Shopify offer graphql APIs which are consumed by the nextjs app whereas with woocommerce we need to develop our own resolvers (or find a plug-in)?

And the reason it’s preferred to adopt graphql rather than consume the standard woocommerce rest api is speed?

Has thought been given to the Cart API and user authentication?

Other headless woocommerce implementations I have researched used CoCart plugin because woocommerce cart API is not public.

Also what is the situation with user authentication? From what I’ve read it seems the core Wordpress REST API is limited. You’d need to have a plugin like https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api to be able to issue auth tokens.

Hello buddy, would appreciate if you do check my repo and contribute

Right now i stopped the progress in order to adapt to the changes next team made on agnostic branch

You have a valid point, but there is a highly usable free gql plugin that am using, which will be published alongside woocommerce implementation as zip folder

Why am using it?

Because it supports cart and easliy usable with auth

Why am avoid rest so far?

Many features are missing from it like cart, which will require the frontend to store the cart on client side

So far am avoiding that and am using the graphql plugin

https://github.com/wp-graphql/wp-graphql-woocommerce

What is done on my side so far is

Cart functionality, products functionality, pages,
Stopped before going to checkout + login, register and user until i migrate the code

@mohammadou1
Copy link
Contributor

I will push the latest update tomorrow hopefully and if you wish then we can have a conv where we can work on supporting both options even though rest is limited while accepting it??

And still one of the biggest woocommerce limitations is multi languages which is another story for another night

@mohammadou1
Copy link
Contributor

And you're 100% right

Most implementation use CoCart for rest api cart implementation

But if I was gonna use it to support the cart only, then I need to take into consideration that some people will use other plugins and need to find a way to let them choose their cart functionality between default cart and cocart

@willopez
Copy link

@mohammadou1 I am interested in contributing to this provider, once you integrate the agnostic UI updates, I would like to see how I can help.

@seb86
Copy link

seb86 commented Apr 6, 2021

And you're 100% right

Most implementation use CoCart for rest api cart implementation

But if I was gonna use it to support the cart only, then I need to take into consideration that some people will use other plugins and need to find a way to let them choose their cart functionality between default cart and CoCart

Let me know what I can do to help. Happy to answer any questions regarding CoCart.

@willopez
Copy link

willopez commented Apr 7, 2021

@mohammadou1 just wondering if there is any active development on this?

@Popeyef5
Copy link

Hi @mohammadou1! I'm also interested in this. How's it going along? Is there anything we can do to help?

@okbel
Copy link
Contributor Author

okbel commented Apr 12, 2021

LMK if someone feels proficient enough with WooCommerce to add https://github.com/mohammadou1/commerce/tree/feature/woocommerce to this repo, as a provider. Thank you! 🙏

@Popeyef5
Copy link

@okbel the documentation https://github.com/vercel/commerce/blob/master/framework/commerce/new-provider.md says that there's currently a refactor going on. Should we wait for an announcement or can we just mimic the structure in the current shopify and bigcommerce framework implementations?

@mohammadou1
Copy link
Contributor

Hello, yes there is a refactor going on right now

I will push the roadmap of it soon, my sincere apologise for slow progress

Feel free to dive in the repo and tag along

Will push the roadmap ASAP

@mohammadou1
Copy link
Contributor

@mohammadou1 just wondering if there is any active development on this?

Yes there is, even though its slow,

@olegrob
Copy link

olegrob commented Apr 13, 2021

Looking forward for the new updates

@olegrob
Copy link

olegrob commented Apr 13, 2021

@mohammadou1 any ideas why cant i run this locally - https://github.com/mohammadou1/commerce/tree/feature/woocommerce ? I get error "Error: The environment variable BIGCOMMERCE_STOREFRONT_API_URL is missing and it's required to access your store"

and even thought ".env.local" has only this attributes -

"GRAPHQL_STORE_URL=
WOOCOMMERCE_API_URL=
WOOCOMMERCE_CONSUMER_KEY=
WOOCOMMERCE_CONSUMER_SECRET="

@Popeyef5
Copy link

It seems it's configured for Bigcommerce and not WooCommerce. I think that error appears when you import Bigcommerce's config.

@olegrob
Copy link

olegrob commented Apr 15, 2021

It seems it's configured for Bigcommerce and not WooCommerce. I think that error appears when you import Bigcommerce's config.

Weird because i tried even to add this conf into env.local: COMMERCE_PROVIDER=woocommerce , hoped that it will force to import right settings. Havent got any luck, still tries to import bigcommerce settings.

@mohammadou1
Copy link
Contributor

Yes the issue appears when u try to access pages that are not under /wocommerce folder, this is due to not removing big commerce from pages yet as it should migrate woocommerce instead,

@Popeyef5
Copy link

@mohammadou1 I'm hesitant to contribute to the repo because the folder structure is so different from the other providers in vercel's repo. Is that part of the refactor you were talking about? Do you have an ETA for the roadmap?

@mohammadou1
Copy link
Contributor

@mohammadou1 I'm hesitant to contribute to the repo because the folder structure is so different from the other providers in vercel's repo. Is that part of the refactor you were talking about? Do you have an ETA for the roadmap?

Am really in a bad situation here, since woocommerce has really different structure than other providers, no cart, no multilanguage, graphql different approach, waiting for few changes to come from official next/commerce before I can do anything, this file structure was the old file structure followed by the providers, since they updated, woocommerce has been stuck, which needs to almost restart the provider,

if anyone is interested in diving in so we can start it as soon as the changes from next/commerce come up, please notify me

@sixers
Copy link

sixers commented May 6, 2021

@mohammadou1 Which exact changes are you "waiting" for? Is it this issue?

@mohammadou1
Copy link
Contributor

@mohammadou1 Which exact changes are you "waiting" for? Is it this issue?

Technically,
Waiting for normalization changes to support
woocommerce lack of some data

Not in enforce multilnaguages
Not to enforce api routes and just use gql

Currently contacted the team about them and they are making the changes
Then i can start over with the latest version

As soon as they are done
Will post it here, so that anyone can join in building this provider hopefully

Am sorry for so much delay

@mohammadou1
Copy link
Contributor

@mohammadou1 Which exact changes are you "waiting" for? Is it this issue?

Yes it's, the current structure doesn't support woocommerce, especially that the plan to support woocommerce is using GQL plugin built by the community

could finish the previous version (current one in github) but its no way near the updated next/commerce version and not unified at all

@mohammadou1
Copy link
Contributor

Updated the readme, my apologize because its too late and nothing happened yet, but the main goal of the providers I think is to have a unified solution for everyone regardless of the differences or weakness of specific ones

@senadir
Copy link

senadir commented May 21, 2021

Hey, all you aware of WooCommerce Store API, an API that is meant to build headless WooCommerce stores

@Popeyef5
Copy link

Popeyef5 commented Jun 3, 2021

Seems promising, I'll give it a go when I'm more free. In case this does not work out (seems experimental still, idk how permanent resources need to be for a PR to be considered), what's the policy on packages @okbel? I think I saw shopify-buy in the dependencies but not used anywhere thoughout the project. Would we be allowed to use, for instance, something like this https://github.com/woocommerce/woocommerce-rest-api-js-lib? Or not?

@seb86
Copy link

seb86 commented Aug 10, 2021

Hey all. CoCart will be releasing an update soon that provides a more out of the box experience and was wondering if you would be interested in supporting CoCart since the WooCommerce API is still not public or open enough to supporting WooCommerce extensions or guest customers for frameworks?

Let let me know if you have any questions.

Thank you.

Sébastien Dumont - Creator of CoCart.

@mcabappa2019
Copy link

Hi all,
I have made a project on it. You can check the live demo site from https://nextwoocom.vercel.app/

@ramyareye
Copy link

ramyareye commented Oct 3, 2021

As I mentioned here I made a very first version based on wp-graphql and wp-graphql-woocommerce:
source - demo
*Due to have the demo, I commented some functionalities.

steps to reproduce

  • clone this project and install Wordpress (Wordpress + an empty theme + required plugins)
  • activate plugins
  • go to products importer from wp-admin -> Tools -> Import -> WooCommerce products (CSV) -> run importer
  • select sample products -> /wp/wp-content/plugins/woocommerce/sample-data/sample_products.csv
  • go to wp-admin -> GraphQL -> Settings and check Enable Public Introspection
  • clone https://github.com/ramyareye/commerce
  • cp .env.template to .env.local and edit it
    • COMMERCE_PROVIDER=woocommerce
    • NEXT_PUBLIC_WOOCOMMERCE_SHOP_API_URL=http://wp.address/graphql
    • NEXT_PUBLIC_WOOCOMMERCE_IMAGES_DOMAIN=wp.address
  • yarn
  • yarn generate:wpc
  • yarn dev and it's working :) you can also deploy it on vercel

This is a sample and there is still a lot tasks to handle, I describe my ongoing process and put a list here so we can go through, beside I would appreciate your opinions and ideas.

Wordpress has its own datatypes including Posts, Pages, Categories, Tags, ...
By adding WooCommerce we define a new Products posttype on top of it and wp-graphql-woocommerce is doing the rest for us.
Till here we can query Products but we are facing some dificulties! You can add six types of products to WooCommerce by default. These include simple products, virtual products, downloadable products, grouped products, external products, and variable products. However, WooCommerce also supports other extensions that add more product types to your store.
So we have to define Commerce Product Type extending these types which is a bit complicated. I already made a simple working version of that.

TODO

  • implement a Wordpress theme and plugin which includes all data below
  • products (WIP) : it's available in WPGraphQL
  • cart : it's available in WPGraphQL
  • search : it's available in WPGraphQL
  • wishlist : we need to implement it with WPGraphQL
  • customerAuth : https://www.wpgraphql.com/docs/authentication-and-authorization/
  • customCheckout : it's available in WPGraphQL
  • locals : Wordpress has one local by default, to add others we need to use an external plugin like WPML or polylang or ...

Features I think we need to implement though:

As I only work on these on weekends I guess it takes 4-6 weeks to have a real version.
I would be happy if anyone got time to contribute, also would be nice if we align this process with Commerce team.

@xpd
Copy link

xpd commented Mar 14, 2022

Is this still being worked on?

@hofewo
Copy link

hofewo commented Jun 2, 2022

Is this still being worked on?

would be nice if so. Im willing to contribute then

@RvDstudio
Copy link

Is there any news about this?

@Uranbold
Copy link

Wanna Contribute

@manovotny
Copy link
Collaborator

Hey there! Thank you for your contribution. We have decided to take Next.js Commerce in a new direction and will be closing out current PRs and issues due to this change. Please see this PR for more details: #966

@Uranbold
Copy link

What happened to Woocommerce Integration?

@Uranbold
Copy link

Any update guys?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in-progress
Projects
None yet
Development

No branches or pull requests