質問

i have added a new WooCommerce Custom Payment Gateway plugin, this plugin show me the 2checkout features in woocommerce setting page like this

![enter image description here][1]

but how can I send my product value in 2co site when user check the 2checkout option and click the place order button then what action perform in front of site

Ive attached an image of my woocommerce custom payment gateway plugin, file name is class-wc-custom_payment_gateway_1 so in this file i have use the below code

<form action='https://www.2checkout.com/checkout/purchase' method='post'>
<input type='hidden' name='sid' value='5456777' >
<input type='hidden' name='product_id' value='10' >
<input type='hidden' name='quantity' value='1' >
<input name='submit' type='submit' value='Add to Cart' >
</form>

how can i get get form value in this form which i have set in payment gateway 2checkout page and how to redirect form value on click the place order button on site

this is my product detail and i sent the product detail on click the place order button

Thank you for your reply

役に立ちましたか?

解決

You need to add all the parameters which need to be send to 2co in the form with a for loop

foreach ($this->params as $name => $value) {
   echo "<input type=\"hidden\" name=\"$name\" value=\"$value\"/>\n";
}

And submit the form , I found this on 2CO Dynamic payment gateway plugin

他のヒント

When using a third party cart like WooCommerce, you do not want to create products in your 2Checkout account. You can pass your lineitem details in dynamically using the Pass Through Products parameter set or Third Party Cart parameter set.

In your custom WooCommerce module, under the generate_*your_gateway_name*_form method, you need to generate your 2Checkout form or link from the order object and output the HTML to initiate the redirect. Your custom configuration inputs would be set as properties on your custom Gateway class so they can be set and accessed like below:

```

// Set Value
$this->my_property_name = $this->get_option('my_property_name');

// Get Value
$this->my_property_name;

```

You can see an example in this custom 2Checkout module I did for 2Checkout's PayPal Direct method. Feel free to use this module as a template for your own custom module.

You can also contact 2Checkout tech support directly for help at any time at techsupport@2co.com.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top