rock-solid / pwa-theme-woocommerce

E-commerce Progressive Web App Theme (React & Redux)
http://pwacommerce.com
MIT License
428 stars 163 forks source link

Checkout button doesn't redirect to checkout page (pwacommerce pro) #57

Open AsaraelNavarro opened 6 years ago

AsaraelNavarro commented 6 years ago

Describe the bug Checkout button doesn't redirect to checkout page

To Reproduce Steps to reproduce the behavior:

  1. Select product
  2. Select variations
  3. Click in checkout button
  4. Redirect to homepage

Expected behavior Redirect to ckeckout page

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

Wordpress: 4.9.8 woocommerce: 3.4.2 (Tested in 3.1 too)

Additional context Jupiter Theme 6.1.5

anghelalexandra commented 6 years ago

Hey @Asarael

Can you check if the CHECKOUT_URL variable is set up correctly in the index file (view source)? This checkout url should be set up from the WooCommerce settings and the app should submit the cart contents to the WordPress main theme.

AsaraelNavarro commented 6 years ago

Tanks for the answer. The checkout url is set up correctly in WooCommerce. This is the code in the file $config = [ 'API_CATEGORIES_URL' => $api_url . 'categories/', 'API_PRODUCTS_URL' => $api_url . 'products/', 'API_PRODUCT_URL' => $api_url . 'product/', 'API_REVIEWS_URL' => $api_url . 'reviews/', 'API_VARIATIONS_URL' => $api_url . 'product-variations/', 'API_CHECKOUT_URL' => $api_url . 'proceed-checkout/', 'CURRENCY' => get_woocommerce_currency_symbol(), 'SHOP_NAME' => $site_name, 'OFFLINE' => 'true', ];

anghelalexandra commented 6 years ago

@Asarael

What is the value of API_CHECKOUT_URL if you view the source of the index file in the browser? It should be something like "http://{your_wordpress_installation_url}/wp-json/pwacommercepro/proceed-checkout". Can you check if that url exists (if you open it in a browser)?

AsaraelNavarro commented 6 years ago

Hi, @anghelalexandra the url exist. There is the value.

"API_CHECKOUT_URL":"https:\/\/valdov.com.mx\/wp-json\/pwacommercepro\/proceed-checkout\/","CURRENCY":"$","SHOP_NAME":"Valdov","OFFLINE":"true"} }

anghelalexandra commented 6 years ago

Hey @Asarael ,

It looks the route is not registered (404 not found status). From the output:

{"code":"rest_no_route","message":"No se encontr\u00f3 la ruta que coincida con la URL y el m\u00e9todo de la petici\u00f3n","data":{"status":404}}

Does the message change if you activate the plugin?

AsaraelNavarro commented 6 years ago

Hey @anghelalexandra The message doesn't change.

Checking with DevTools noticed that. image

could be the problem?

anghelalexandra commented 6 years ago

@Asarael

I'm not sure if this is the problem. Do other API routes work? Can you see products and categories in the app?

API routes are registered from the backend (WordPress plugin): https://github.com/appticles/wordpress-pwacommerce/blob/master/includes/class-pwacommerce-api.php. The path to the file is the same in the PRO version.

Can you check if the register_pwacommercepro_routes function is called? The routes will be registered only if you have entered a WooCommerce key and secret from the PWACommerce admin area, but it is weird if products and categories are working and checkout is not.

AsaraelNavarro commented 6 years ago

@anghelalexandra The function is called, i can see products and categories. I have changed the WooCommerce key but not work.