Skip to content

Instantly share code, notes, and snippets.

@GiovanniCavallari
Last active March 10, 2022 19:40
Show Gist options
  • Save GiovanniCavallari/78958524caf3b964d1e01167a4f19850 to your computer and use it in GitHub Desktop.
Save GiovanniCavallari/78958524caf3b964d1e01167a4f19850 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