Jump to content

[Recurso] Remover Gatways para registros de domínios.


Recommended Posts

Posted

Olá,

Estava precisando de um hook para remover alguns gw do carrinho de compra para registro de domínios. Então, consegui fazer essa adaptação do bendrop quem desejar, és ai:

 

<?php

/* Remove formas de pagamento para registro de domínio direto no carrinho */

function cart_remove_gateway($vars)
{

	if ($vars['templatefile']=='viewcart' && (count($vars['domains']) > 0 || count($vars['renewals']) > 0 )){

		// List of gateways to remove
		$disallowed = array('souzapagseguro', 'stripe', 'coinpayments');

		$gateways = $vars['gateways'];
		
		foreach ($gateways as $k => $item) {
			if (in_array($item['sysname'],$disallowed)) {
				unset($gateways[$k]);
			}
		} 
		return array("gateways" => $gateways);
	}
	
}
add_hook("ClientAreaPageCart", 1, "cart_remove_gateway");

 


Posted
22 horas atrás, Edilson Souza disse:

Olá,

Estava precisando de um hook para remover alguns gw do carrinho de compra para registro de domínios. Então, consegui fazer essa adaptação do bendrop quem desejar, és ai:

 

<?php

/* Remove formas de pagamento para registro de domínio direto no carrinho */

function cart_remove_gateway($vars)
{

	if ($vars['templatefile']=='viewcart' && (count($vars['domains']) > 0 || count($vars['renewals']) > 0 )){

		// List of gateways to remove
		$disallowed = array('souzapagseguro', 'stripe', 'coinpayments');

		$gateways = $vars['gateways'];
		
		foreach ($gateways as $k => $item) {
			if (in_array($item['sysname'],$disallowed)) {
				unset($gateways[$k]);
			}
		} 
		return array("gateways" => $gateways);
	}
	
}
add_hook("ClientAreaPageCart", 1, "cart_remove_gateway");

 

Valeu  pela contribuição. Ainda não testei aqui mas é um recurso que estava justamente procurando.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Do you agree with our terms?