Skip to content

Instantly share code, notes, and snippets.

@lira
Forked from GiovanniCavallari/mercadopago-iva.php
Created March 10, 2022 19:40
Show Gist options
  • Save lira/cf737884b92c6c2e655e8447de4b6ea4 to your computer and use it in GitHub Desktop.
Save lira/cf737884b92c6c2e655e8447de4b6ea4 to your computer and use it in GitHub Desktop.
IVA Customization for mercadopago plugin for woocommerce
/**
* WC_WooMercadoPago_PreferenceAbstract.php
*/
// Declare the taxes variable at the beginning of the file
protected $taxes;
// Set the value on constructor
$this->taxes = 500;
// Add the getter at the end of the file
/**
* @return array
*/
public function getIvaTaxes()
{
if (get_option('_site_id_v1')) {
return array(
"net_amount" => $this->order_total,
"taxes" => array([
"value" => $this->taxes,
"type" => "IVA"
])
);
}
}
/**
* WC_WooMercadoPago_PreferenceBasic.php
*/
// Set the IvaGetter at the end of constructor
$this->preference = array_merge($this->preference, $this->getIvaTaxes());
/**
* WC_WooMercadoPago_PreferenceCustom.php
*/
// Set the IvaGetter at the end of constructor
$this->preference = array_merge($this->preference, $this->getIvaTaxes());
/**
* WC_WooMercadoPago_PreferenceTicket.php
*/
// Set the IvaGetter at the end of constructor
$this->preference = array_merge($this->preference, $this->getIvaTaxes());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment