• Resolved Juan Pablo Baeza

    (@aescobar0)


    Hi everybody! I’m new to WooCommerce and I’m developing a custom payment gateway. I already developed it for shortcode checkouts, but I want to add support for blocks checkouts. So far I followed?this documentation, but I’m stuck trying to make everything work. I have developed everything (pretty basic tho, I’m just trying to show stuff on the screen so far), including my js and php files, but I’m stuck at trying to make my?index.js?to get succesfully compiled. What I’m doing is to run?npm run build?— which runs?wp-scripts build –, but I get the following error:?Module not found: Error: Can't resolve '@woocommerce/blocks-registry' in ...?, so I’m guessing that I’m not importing correctly that module.
    I’m not sure if I’m following a correct process to compile, so I explain it (take in consideration that every route that I mention from here on is inside my plugin, i.e.?/wp-content/my_plugin/):

    1. I created all my js files (currently 1, but anyway) and saved the index.js  file in src/.
    2. Run npm run build inside my plugin folder and wait for it to compile my files into build/index.js
    3. Hopefully get my plugin rendered in WooCommerce checkout.

    What is it that I’m doing wrong? I also tried to use const { registerPaymentMethod } = window.wc.wcBlocksRegistry; (I’m developing a regular payment method, not an express one) instead of importing registerPaymentMethod , but I get an error indicating that window.wc  is undefined.
    Hope somebody can help me!

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Payment gateway block not working’ is closed to new replies.