Title: Limitar Parcelamento.
Last modified: May 28, 2020

---

# Limitar Parcelamento.

 *  [tharlescunha](https://wordpress.org/support/users/tharlescunha/)
 * (@tharlescunha)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/)
 * Bom dia, eu queria limitar em 3 o numero de parcelas disponíveis, para o cliente
   dividir sua compra, como eu faço isso ??
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Flimitar-parcelamento-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/)
 * (@patrick3623)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12906596)
 * Por padrão você não possui essa opção de limitar as parcelas, oque você pode 
   fazer é no pagseguro configurar para se responsabilizar pelo juros de até X parcelas,
   então acima disso a taxa de juros fica pela responsabilidade do cliente.
    Mas
   quem tem a escolha é o cliente.
 * Essa configuração pode sem feita em:
    [https://pagseguro.uol.com.br/installment/configuration.jhtml](https://pagseguro.uol.com.br/installment/configuration.jhtml)
 *  Thread Starter [tharlescunha](https://wordpress.org/support/users/tharlescunha/)
 * (@tharlescunha)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12906614)
 * Ok, essa parte eu entendi, mas eu quero tirar as opções, quero deixar apenas 
   3 opções, mesmo que o cliente poderia arcar com os juros, e não influenciar nada
   pramim, mas eu queria na na pagina do Checkout, só aparece opção de 3 parcelas,
   tem como eu fazer isso pelo menos no codigo.
 *  [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/)
 * (@patrick3623)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12906627)
 * Se você consegue editar o código fonte do plugin, você possui essa liberdade…
 *  Thread Starter [tharlescunha](https://wordpress.org/support/users/tharlescunha/)
 * (@tharlescunha)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12906641)
 * Eu já procurei onde tem aquelas configurações, mas ainda não encontrei, você 
   sabe onde eu encontro o código daquela pagina, pramim editar o combobox, e aparecer
   apenas 3 opções de parcelas ??
 *  [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/)
 * (@patrick3623)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12906779)
 * Oque você precisa mexer acredito que seja em:
    [https://github.com/claudiosanches/woocommerce-pagseguro/blob/master/includes/class-wc-pagseguro-gateway.php](https://github.com/claudiosanches/woocommerce-pagseguro/blob/master/includes/class-wc-pagseguro-gateway.php)
 * Não sou programador php então, verifique
 * na função save_payment_meta_data
 * antes que ele insira os installments no campo vc precisa remover os que vc deseja…
 * $meta_data[ __( ‘Installments’, ‘woocommerce-pagseguro’ ) ] = $payment_data[‘
   installments’];
 * Aparentemente é isso.
 *  Thread Starter [tharlescunha](https://wordpress.org/support/users/tharlescunha/)
 * (@tharlescunha)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12906915)
 * Esse é o meu arquivo class-wc-pagseguro-gateway, também não entendo muito de 
   PHP, mas olhando esse código, não vi nenhum laço de repetição, e nem encontrei
   onde ele carrega as 12 opções de parcelas no combobox, se não for muito incômodo,
   e desculpe leiguice, sei que deveria procurar um programador, pode me ajudar,
   qual linha de código eu devo modificar, para que seja carregada apenas 3 opções
   de parcelamento, e não 12.
 * <?php
    /** * WooCommerce PagSeguro Gateway class * * [@package](https://wordpress.org/support/users/package/)
   WooCommerce_PagSeguro/Classes/Gateway * [@version](https://wordpress.org/support/users/version/)
   2.13.0 * Arquivo modificado por Ricardo Martins em 4 de Setembro de 2019 (GPLv2)*/
 * if ( ! defined( ‘ABSPATH’ ) ) {
    exit; }
 * /**
    * WooCommerce PagSeguro gateway. */ class WC_PagSeguro_Gateway extends WC_Payment_Gateway{
 *  /**
    * Constructor for the gateway. */ public function __construct() { $this-
   >id = ‘pagseguro’; $this->icon = apply_filters( ‘woocommerce_pagseguro_icon’,
   plugins_url( ‘assets/images/pagseguro.png’, plugin_dir_path( __FILE__ ) ) ); 
   $this->method_title = __( ‘PagSeguro’, ‘woo-pagseguro-rm’ ); $this->method_description
   = __( ‘Accept payments by credit card, bank debit or banking ticket using the
   PagSeguro.’, ‘woo-pagseguro-rm’ ); $this->order_button_text = __( ‘Proceed to
   payment’, ‘woo-pagseguro-rm’ );
 *  // Load the form fields.
    $this->init_form_fields();
 *  // Load the settings.
    $this->init_settings();
 *  // Define user set variables.
    $this->title = $this->get_option( ‘title’ ); 
   $this->description = $this->get_option( ‘description’ ); $this->email = $this-
   >get_option( ’email’ ); $this->token = $this->get_option( ‘token’ ); $this->public_key
   = $this->get_option( ‘public_key’ ); //added by Ricardo Martins $this->sandbox_email
   = $this->get_option( ‘sandbox_email’ ); $this->sandbox_token = $this->get_option(‘
   sandbox_token’ ); $this->method = $this->get_option( ‘method’, ‘direct’ ); $this-
   >tc_credit = $this->get_option( ‘tc_credit’, ‘yes’ ); $this->tc_transfer = $this-
   >get_option( ‘tc_transfer’, ‘yes’ ); $this->tc_ticket = $this->get_option( ‘tc_ticket’,‘
   yes’ ); $this->tc_ticket_message = $this->get_option( ‘tc_ticket_message’, ‘yes’);
   $this->send_only_total = $this->get_option( ‘send_only_total’, ‘no’ ); $this-
   >invoice_prefix = $this->get_option( ‘invoice_prefix’, ‘WC-‘ ); $this->sandbox
   = $this->get_option( ‘sandbox’, ‘no’ ); $this->debug = $this->get_option( ‘debug’);
 *  // Active logs.
    if ( ‘yes’ === $this->debug ) { if ( function_exists( ‘wc_get_logger’)){
   $this->log = wc_get_logger(); } else { $this->log = new WC_Logger(); } }
 *  // Set the API.
    $this->api = new WC_PagSeguro_API( $this );
 *  // Main actions.
    add_action( ‘woocommerce_api_wc_pagseguro_gateway’, array(
   $this, ‘ipn_handler’ ) ); add_action( ‘valid_pagseguro_ipn_request’, array( $
   this, ‘update_order_status’ ) ); add_action( ‘woocommerce_update_options_payment_gateways_’.
   $this->id, array( $this, ‘process_admin_options’ ) ); add_action( ‘woocommerce_receipt_’.
   $this->id, array( $this, ‘receipt_page’ ) );
 *  // Transparent checkout actions.
    if ( ‘transparent’ === $this->method ) { add_action(‘
   woocommerce_thankyou_’ . $this->id, array( $this, ‘thankyou_page’ ) ); add_action(‘
   woocommerce_email_after_order_table’, array( $this, ’email_instructions’ ), 10,
   3 ); add_action( ‘wp_enqueue_scripts’, array( $this, ‘checkout_scripts’ ) ); }}
 *  /**
    * Returns a bool that indicates if currency is amongst the supported ones.**
   [@return](https://wordpress.org/support/users/return/) bool */ public function
   using_supported_currency() { return ‘BRL’ === get_woocommerce_currency(); }
 *  /**
    * Get email. * * [@return](https://wordpress.org/support/users/return/)
   string */ public function get_email() { return ‘yes’ === $this->sandbox ? $this-
   >sandbox_email : $this->email; }
 *  /**
    * Get token. * * [@return](https://wordpress.org/support/users/return/)
   string */ public function get_token() { return ‘yes’ === $this->sandbox ? $this-
   >sandbox_token : $this->token; }
 *  /**
    * Returns a value indicating the the Gateway is available or not. It’s 
   called * automatically by WooCommerce before allowing customers to use the gateway*
   for payment. * * [@return](https://wordpress.org/support/users/return/) bool */
   public function is_available() { // Test if is valid for use. $available = ‘yes’
   === $this->get_option( ‘enabled’ ) && ” !== $this->get_email() && ” !== $this-
   >get_token() && $this->using_supported_currency();
 *  if ( ‘transparent’ === $this->method && ! class_exists( ‘Extra_Checkout_Fields_For_Brazil’)){
   
   $available = false; }
 *  return $available;
    }
 *  /**
    * Has fields. * * [@return](https://wordpress.org/support/users/return/)
   bool */ public function has_fields() { return ‘transparent’ === $this->method;}
 *  /**
    * Checkout scripts. */ public function checkout_scripts() { if ( is_checkout()&&
   $this->is_available() ) { if ( ! get_query_var( ‘order-received’ ) ) { $session_id
   = $this->api->get_session_id(); $suffix = defined( ‘SCRIPT_DEBUG’ ) && SCRIPT_DEBUG?”:‘.
   min’;
 *  wp_enqueue_style( ‘pagseguro-checkout’, plugins_url( ‘assets/css/frontend/transparent-
   checkout’ . $suffix . ‘.css’, plugin_dir_path( __FILE__ ) ), array(), WC_PAGSEGURO_VERSION);
   
   wp_enqueue_script( ‘pagseguro-library’, $this->api->get_direct_payment_url(),
   array(), WC_PAGSEGURO_VERSION, true ); wp_enqueue_script( ‘pagseguro-checkout’,
   plugins_url( ‘assets/js/frontend/transparent-checkout’ . $suffix . ‘.js’, plugin_dir_path(
   __FILE__ ) ), array( ‘jquery’, ‘pagseguro-library’, ‘woocommerce-extra-checkout-
   fields-for-brazil-front’ ), WC_PAGSEGURO_VERSION, true );
 *  wp_localize_script(
    ‘pagseguro-checkout’, ‘wc_pagseguro_params’, array( ‘session_id’
   => $session_id, ‘interest_free’ => __( ‘interest free’, ‘woo-pagseguro-rm’ ),‘
   invalid_card’ => __( ‘Invalid credit card number.’, ‘woo-pagseguro-rm’ ), ‘invalid_expiry’
   => __( ‘Invalid expiry date, please use the MM / YYYY date format.’, ‘woo-pagseguro-
   rm’ ), ‘expired_date’ => __( ‘Please check the expiry date and use a valid format
   as MM / YYYY.’, ‘woo-pagseguro-rm’ ), ‘general_error’ => __( ‘Unable to process
   the data from your credit card on the PagSeguro, please try again or contact 
   us for assistance.’, ‘woo-pagseguro-rm’ ), ’empty_installments’ => __( ‘Select
   a number of installments.’, ‘woo-pagseguro-rm’ ), ) ); } } }
 *  /**
    * Get log. * * [@return](https://wordpress.org/support/users/return/) string*/
   protected function get_log_view() { if ( defined( ‘WC_VERSION’ ) && version_compare(
   WC_VERSION, ‘2.2’, ‘>=’ ) ) { return ‘id ) . ‘-‘ . sanitize_file_name( wp_hash(
   $this->id ) ) . ‘.log’ ) ) . ‘”>’ . __( ‘System Status > Logs’, ‘woo-pagseguro-
   rm’ ) . ‘‘; }
 *  return ‘`woocommerce/logs/' . esc_attr( $this->id ) . '-' . sanitize_file_name(
   wp_hash( $this->id ) ) . '.txt`‘;
    }
 *  /**
    * Initialise Gateway Settings Form Fields. */ public function init_form_fields(){
   $this->form_fields = array( ‘enabled’ => array( ‘title’ => __( ‘Enable/Disable’,‘
   woo-pagseguro-rm’ ), ‘type’ => ‘checkbox’, ‘label’ => __( ‘Enable PagSeguro’,‘
   woo-pagseguro-rm’ ), ‘default’ => ‘yes’, ), ‘title’ => array( ‘title’ => __( ‘
   Title’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘text’, ‘description’ => __( ‘This controls
   the title which the user sees during checkout.’, ‘woo-pagseguro-rm’ ), ‘desc_tip’
   => true, ‘default’ => __( ‘PagSeguro’, ‘woo-pagseguro-rm’ ), ), ‘description’
   => array( ‘title’ => __( ‘Description’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘textarea’,‘
   description’ => __( ‘This controls the description which the user sees during
   checkout.’, ‘woo-pagseguro-rm’ ), ‘default’ => __( ‘Pay via PagSeguro’, ‘woo-
   pagseguro-rm’ ), ), ‘integration’ => array( ‘title’ => __( ‘Integration’, ‘woo-
   pagseguro-rm’ ), ‘type’ => ‘title’, ‘description’ => ”, ), ‘method’ => array(‘
   title’ => __( ‘Integration method’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘select’,‘
   description’ => __( ‘Choose how the customer will interact with the PagSeguro.
   Redirect (Client goes to PagSeguro page) or Lightbox (Inside your store)’, ‘woo-
   pagseguro-rm’ ), ‘desc_tip’ => true, ‘default’ => ‘direct’, ‘class’ => ‘wc-enhanced-
   select’, ‘options’ => array( ‘redirect’ => __( ‘Redirect (default)’, ‘woo-pagseguro-
   rm’ ), ‘lightbox’ => __( ‘Lightbox’, ‘woo-pagseguro-rm’ ), ‘transparent’ => __(‘
   Transparent Checkout’, ‘woo-pagseguro-rm’ ), ), ), //modified by Ricardo Martins‘
   sandbox’ => array( ‘title’ => __( ‘PagSeguro Sandbox’, ‘woo-pagseguro-rm’ ), ‘
   type’ => ‘checkbox’, ‘label’ => __( ‘Enable PagSeguro Sandbox (KEEP IT DISABLED)’,‘
   woo-pagseguro-rm’ ), ‘desc_tip’ => true, ‘default’ => ‘no’,
 *  ‘description’ => __( ‘PagSeguro Sandbox can be used to test the payments.’, ‘
   woo-pagseguro-rm’ ),
    ), ’email’ => array( ‘title’ => __( ‘PagSeguro Email’, ‘
   woo-pagseguro-rm’ ), ‘type’ => ‘text’, ‘description’ => __( ‘Please enter your
   PagSeguro email address. This is needed in order to take payment.’, ‘woo-pagseguro-
   rm’ ), ‘desc_tip’ => true, ‘default’ => ”, ), ‘token’ => array( ‘title’ => __(‘
   PagSeguro Token’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘text’, /* translators: %s:
   link to PagSeguro settings */ ‘description’ => sprintf( __( ‘Please enter your
   PagSeguro token. This is needed to process the payment and notifications. Is 
   possible generate a new token %s.’, ‘woo-pagseguro-rm’ ), ‘[‘ . __( ‘here’, ‘woo-pagseguro-rm’ ) . ‘](https://pagseguro.uol.com.br/integracao/token-de-seguranca.jhtml)‘),‘
   default’ => ”, ), //modified by Ricardo Martins ‘public_key’ => array( ‘title’
   => __( ‘PagSeguro App Key’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘text’, /* translators:%
   s: link to PagSeguro settings */ ‘description’ => sprintf( __( ‘To get your app
   key, authorize the app. %s to authorize it (it\’s free).’, ‘woo-pagseguro-rm’),‘
   [‘ . __( ‘Click here’, ‘woo-pagseguro-rm’ ) . ‘](https://r-martins.github.io/PagSeguro-Magento-Transparente/woocommerce/wizard.html)‘),‘
   default’ => ”, ), ‘sandbox_email’ => array( ‘title’ => __( ‘PagSeguro Sandbox
   Email’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘text’, /* translators: %s: link to PagSeguro
   settings */ ‘description’ => sprintf( __( ‘Please enter your PagSeguro sandbox
   email address. You can get your sandbox email %s.’, ‘woo-pagseguro-rm’ ), ‘[‘ . __( ‘here’, ‘woo-pagseguro-rm’ ) . ‘](https://sandbox.pagseguro.uol.com.br/vendedor/configuracoes.html)‘),‘
   default’ => ”, ), ‘sandbox_token’ => array( ‘title’ => __( ‘PagSeguro Sandbox
   Token’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘text’, /* translators: %s: link to PagSeguro
   settings */ ‘description’ => sprintf( __( ‘Please enter your PagSeguro sandbox
   token. You can get your sandbox token %s.’, ‘woo-pagseguro-rm’ ), ‘[‘ . __( ‘here’, ‘woo-pagseguro-rm’ ) . ‘](https://sandbox.pagseguro.uol.com.br/vendedor/configuracoes.html)‘),‘
   default’ => ”, ), ‘transparent_checkout’ => array( ‘title’ => __( ‘Transparent
   Checkout Options’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘title’, ‘description’ => ”,),‘
   tc_credit’ => array( ‘title’ => __( ‘Credit Card’, ‘woo-pagseguro-rm’ ), ‘type’
   => ‘checkbox’, ‘label’ => __( ‘Enable Credit Card for Transparente Checkout’,‘
   woo-pagseguro-rm’ ), ‘default’ => ‘yes’, ), ‘tc_transfer’ => array( ‘title’ =
   > __( ‘Bank Transfer’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘checkbox’, ‘label’ =>
   __( ‘Enable Bank Transfer for Transparente Checkout’, ‘woo-pagseguro-rm’ ), ‘
   default’ => ‘yes’, ), ‘tc_ticket’ => array( ‘title’ => __( ‘Banking Ticket’, ‘
   woo-pagseguro-rm’ ), ‘type’ => ‘checkbox’, ‘label’ => __( ‘Enable Banking Ticket
   for Transparente Checkout’, ‘woo-pagseguro-rm’ ), ‘default’ => ‘yes’, ), ‘tc_ticket_message’
   => array( ‘title’ => __( ‘Banking Ticket Tax Message’, ‘woo-pagseguro-rm’ ), ‘
   type’ => ‘checkbox’, ‘label’ => __( ‘Display a message alerting the customer 
   that will be charged R$ 1,00 for payment by Banking Ticket’, ‘woo-pagseguro-rm’),‘
   default’ => ‘yes’, ), ‘behavior’ => array( ‘title’ => __( ‘Integration Behavior’,‘
   woo-pagseguro-rm’ ), ‘type’ => ‘title’, ‘description’ => ”, ), ‘send_only_total’
   => array( ‘title’ => __( ‘Send only the order total’, ‘woo-pagseguro-rm’ ), ‘
   type’ => ‘checkbox’, ‘label’ => __( ‘If this option is enabled will only send
   the order total, not the list of items.’, ‘woo-pagseguro-rm’ ), ‘default’ => ‘
   no’, ), ‘invoice_prefix’ => array( ‘title’ => __( ‘Invoice Prefix’, ‘woo-pagseguro-
   rm’ ), ‘type’ => ‘text’, ‘description’ => __( ‘Please enter a prefix for your
   invoice numbers. If you use your PagSeguro account for multiple stores ensure
   this prefix is unqiue as PagSeguro will not allow orders with the same invoice
   number.’, ‘woo-pagseguro-rm’ ), ‘desc_tip’ => true, ‘default’ => ‘WC-‘, ), ‘testing’
   => array( ‘title’ => __( ‘Gateway Testing’, ‘woo-pagseguro-rm’ ), ‘type’ => ‘
   title’, ‘description’ => ”, ), ‘debug’ => array( ‘title’ => __( ‘Debug Log’, ‘
   woo-pagseguro-rm’ ), ‘type’ => ‘checkbox’, ‘label’ => __( ‘Enable logging’, ‘
   woo-pagseguro-rm’ ), ‘default’ => ‘no’, /* translators: %s: log page link */ ‘
   description’ => sprintf( __( ‘Log PagSeguro events, such as API requests, inside%
   s’, ‘woo-pagseguro-rm’ ), $this->get_log_view() ), ), ); }
 *  /**
    * Admin page. */ public function admin_options() { $suffix = defined( ‘
   SCRIPT_DEBUG’ ) && SCRIPT_DEBUG ? ” : ‘.min’;
 *  wp_enqueue_script( ‘pagseguro-admin’, plugins_url( ‘assets/js/admin/admin’ .
   $suffix . ‘.js’, plugin_dir_path( __FILE__ ) ), array( ‘jquery’ ), WC_PAGSEGURO_VERSION,
   true );
 *  include dirname( __FILE__ ) . ‘/admin/views/html-admin-page.php’;
    }
 *  /**
    * Send email notification. * * [@param](https://wordpress.org/support/users/param/)
   string $subject Email subject. * [@param](https://wordpress.org/support/users/param/)
   string $title Email title. * [@param](https://wordpress.org/support/users/param/)
   string $message Email message. */ protected function send_email( $subject, $title,
   $message ) { $mailer = WC()->mailer();
 *  $mailer->send( get_option( ‘admin_email’ ), $subject, $mailer->wrap_message(
   $title, $message ) );
    }
 *  /**
    * Payment fields. */ public function payment_fields() { wp_enqueue_script(‘
   wc-credit-card-form’ );
 *  $description = $this->get_description();
    if ( $description ) { echo wpautop(
   wptexturize( $description ) ); // WPCS: XSS ok. }
 *  $cart_total = $this->get_order_total();
 *  if ( ‘transparent’ === $this->method ) {
    wc_get_template( ‘transparent-checkout-
   form.php’, array( ‘cart_total’ => $cart_total, ‘tc_credit’ => $this->tc_credit,‘
   tc_transfer’ => $this->tc_transfer, ‘tc_ticket’ => $this->tc_ticket, ‘tc_ticket_message’
   => $this->tc_ticket_message, ‘flag’ => plugins_url( ‘assets/images/brazilian-
   flag.png’, plugin_dir_path( __FILE__ ) ), ), ‘woocommerce/pagseguro/’, WC_PagSeguro::
   get_templates_path() ); } }
 *  /**
    * Process the payment and return the result. * * [@param](https://wordpress.org/support/users/param/)
   int $order_id Order ID. * [@return](https://wordpress.org/support/users/return/)
   array */ public function process_payment( $order_id ) { $order = wc_get_order(
   $order_id );
 *  if ( ‘lightbox’ !== $this->method ) {
    if ( isset( $_POST[‘pagseguro_sender_hash’])&&‘
   transparent’ === $this->method ) { // WPCS: input var ok, CSRF ok. $response 
   = $this->api->do_payment_request( $order, $_POST ); // WPCS: input var ok, CSRF
   ok.
 *  if ( $response[‘data’] ) {
    $this->update_order_status( $response[‘data’] );}}
   else { $response = $this->api->do_checkout_request( $order, $_POST ); // WPCS:
   input var ok, CSRF ok. }
 *  if ( $response[‘url’] ) {
    // Remove cart. WC()->cart->empty_cart();
 *  if (isset($response[‘data’])) {
    $this->save_payment_meta_data($order, $response[‘
   data’]); } return array( ‘result’ => ‘success’, ‘redirect’ => $response[‘url’],);}
   else { foreach ( $response[‘error’] as $error ) { wc_add_notice( $error, ‘error’);}
 *  return array(
    ‘result’ => ‘fail’, ‘redirect’ => ”, ); } } else { $use_shipping
   = isset( $_POST[‘ship_to_different_address’] ) ? true : false; // WPCS: input
   var ok, CSRF ok.
 *  return array(
    ‘result’ => ‘success’, ‘redirect’ => add_query_arg( array( ‘use_shipping’
   => $use_shipping ), $order->get_checkout_payment_url( true ) ), ); } }
 *  /**
    * Output for the order received page. * * [@param](https://wordpress.org/support/users/param/)
   int $order_id Order ID. */ public function receipt_page( $order_id ) { $order
   = wc_get_order( $order_id ); $request_data = $_POST; // WPCS: input var ok, CSRF
   ok. if ( isset( $_GET[‘use_shipping’] ) && true === (bool) $_GET[‘use_shipping’]){//
   WPCS: input var ok, CSRF ok. $request_data[‘ship_to_different_address’] = true;}
 *  $response = $this->api->do_checkout_request( $order, $request_data );
 *  if ( $response[‘url’] ) {
    // Lightbox script. wc_enqueue_js( ‘ $( “#browser-
   has-javascript” ).show(); $( “#browser-no-has-javascript, #cancel-payment, #submit-
   payment” ).hide(); var isOpenLightbox = PagSeguroLightbox({ code: “‘ . esc_js(
   $response[‘token’] ) . ‘” }, { success: function ( transactionCode ) { window.
   location.href = “‘ . str_replace( ‘&’, ‘&’, esc_js( $this->get_return_url( $order))).‘”;},
   abort: function () { window.location.href = “‘ . str_replace( ‘&’, ‘&’, esc_js(
   $order->get_cancel_order_url() ) ) . ‘”; } }); if ( ! isOpenLightbox ) { window.
   location.href = “‘ . esc_js( $response[‘url’] ) . ‘”; } ‘ );
 *  wc_get_template(
    ‘lightbox-checkout.php’, array( ‘cancel_order_url’ => $order-
   >get_cancel_order_url(), ‘payment_url’ => $response[‘url’], ‘lightbox_script_url’
   => $this->api->get_lightbox_url(), ), ‘woocommerce/pagseguro/’, WC_PagSeguro::
   get_templates_path() ); } else { include dirname( __FILE__ ) . ‘/views/html-receipt-
   page-error.php’; } }
 *  /**
    * IPN handler. */ public function ipn_handler() { @ob_clean(); // phpcs:
   ignore Generic.PHP.NoSilencedErrors.Discouraged
 *  $ipn = $this->api->process_ipn_request( $_POST ); // WPCS: input var ok, CSRF
   ok.
 *  if ( $ipn ) {
    header( ‘HTTP/1.1 200 OK’ ); do_action( ‘valid_pagseguro_ipn_request’,
   $ipn ); exit(); } else { wp_die( esc_html__( ‘PagSeguro Request Unauthorized’,‘
   woo-pagseguro-rm’ ), esc_html__( ‘PagSeguro Request Unauthorized’, ‘woo-pagseguro-
   rm’ ), array( ‘response’ => 401 ) ); } }
 *  /**
    * Save payment meta data. * * [@param](https://wordpress.org/support/users/param/)
   WC_Order $order Order instance. * [@param](https://wordpress.org/support/users/param/)
   array $posted Posted data. */ protected function save_payment_meta_data( $order,
   $posted ) { $meta_data = array(); $payment_data = array( ‘type’ => ”, ‘method’
   => ”, ‘installments’ => ”, ‘link’ => ”, );
 *  if ( isset( $posted->sender->email ) ) {
    $meta_data[ __( ‘Payer email’, ‘woo-
   pagseguro-rm’ ) ] = sanitize_text_field( (string) $posted->sender->email ); }
   if ( isset( $posted->sender->name ) ) { $meta_data[ __( ‘Payer name’, ‘woo-pagseguro-
   rm’ ) ] = sanitize_text_field( (string) $posted->sender->name ); } if ( isset(
   $posted->paymentMethod->type ) ) { // phpcs:ignore WordPress.NamingConventions.
   ValidVariableName.NotSnakeCaseMemberVar $payment_data[‘type’] = intval( $posted-
   >paymentMethod->type ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.
   NotSnakeCaseMemberVar
 *  $meta_data[ __( ‘Payment type’, ‘woo-pagseguro-rm’ ) ] = $this->api->get_payment_name_by_type(
   $payment_data[‘type’] );
    } if ( isset( $posted->paymentMethod->code ) ) { //
   phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
   $payment_data[‘method’] = $this->api->get_payment_method_name( intval( $posted-
   >paymentMethod->code ) ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.
   NotSnakeCaseMemberVar
 *  $meta_data[ __( ‘Payment method’, ‘woo-pagseguro-rm’ ) ] = $payment_data[‘method’];
   }
   if ( isset( $posted->installmentCount ) ) { // phpcs:ignore WordPress.NamingConventions.
   ValidVariableName.NotSnakeCaseMemberVar $payment_data[‘installments’] = sanitize_text_field((
   string) $posted->installmentCount ); // phpcs:ignore WordPress.NamingConventions.
   ValidVariableName.NotSnakeCaseMemberVar
 *  $meta_data[ __( ‘Installments’, ‘woo-pagseguro-rm’ ) ] = $payment_data[‘installments’];
   }
   if ( isset( $posted->paymentLink ) ) { // phpcs:ignore WordPress.NamingConventions.
   ValidVariableName.NotSnakeCaseMemberVar $payment_data[‘link’] = sanitize_text_field((
   string) $posted->paymentLink ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.
   NotSnakeCaseMemberVar
 *  $meta_data[ __( ‘Payment URL’, ‘woo-pagseguro-rm’ ) ] = $payment_data[‘link’];
   }
   if ( isset( $posted->creditorFees->intermediationRateAmount ) ) { // phpcs:ignore
   WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar $meta_data[
   __( ‘Intermediation Rate’, ‘woo-pagseguro-rm’ ) ] = sanitize_text_field( (string)
   $posted->creditorFees->intermediationRateAmount ); // phpcs:ignore WordPress.
   NamingConventions.ValidVariableName.NotSnakeCaseMemberVar } if ( isset( $posted-
   >creditorFees->intermediationFeeAmount ) ) { // phpcs:ignore WordPress.NamingConventions.
   ValidVariableName.NotSnakeCaseMemberVar $meta_data[ __( ‘Intermediation Fee’,‘
   woo-pagseguro-rm’ ) ] = sanitize_text_field( (string) $posted->creditorFees->
   intermediationFeeAmount ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.
   NotSnakeCaseMemberVar }
 *  $meta_data[‘_wc_pagseguro_payment_data’] = $payment_data;
 *  // WooCommerce 3.0 or later.
    if ( method_exists( $order, ‘update_meta_data’)){
   foreach ( $meta_data as $key => $value ) { $order->update_meta_data( $key, $value);}
   $order->save(); } else { foreach ( $meta_data as $key => $value ) { update_post_meta(
   $order->id, $key, $value ); // @codingStandardsIgnoreLine } } }
 *  /**
    * Update order status. * * [@param](https://wordpress.org/support/users/param/)
   array $posted PagSeguro post data. */ public function update_order_status( $posted){
   if ( isset( $posted->reference ) ) { $id = (int) str_replace( $this->invoice_prefix,”,
   $posted->reference ); $order = wc_get_order( $id );
 *  // Check if order exists.
    if ( ! $order ) { return; }
 *  $order_id = method_exists( $order, ‘get_id’ ) ? $order->get_id() : $order->id;
 *  // Checks whether the invoice number matches the order.
    // If true processes
   the payment. if ( $order_id === $id ) { if ( ‘yes’ === $this->debug ) { $this-
   >log->add( $this->id, ‘PagSeguro payment status for order ‘ . $order->get_order_number().‘
   is: ‘ . intval( $posted->status ) ); }
 *  // Save meta data.
    $this->save_payment_meta_data( $order, $posted );
 *  switch ( intval( $posted->status ) ) {
    case 1: $order->update_status( ‘on-hold’,
   __( ‘PagSeguro: The buyer initiated the transaction, but so far the PagSeguro
   not received any payment information.’, ‘woo-pagseguro-rm’ ) );
 *  break;
    case 2: $order->update_status( ‘on-hold’, __( ‘PagSeguro: Payment under
   review.’, ‘woo-pagseguro-rm’ ) );
 *  // Reduce stock for billets.
    if ( function_exists( ‘wc_reduce_stock_levels’)){
   wc_reduce_stock_levels( $order_id ); }
 *  break;
    case 3: // Sometimes PagSeguro should change an order from cancelled
   to paid, so we need to handle it. if ( method_exists( $order, ‘get_status’ ) &&‘
   cancelled’ === $order->get_status() ) { $order->update_status( ‘processing’, 
   __( ‘PagSeguro: Payment approved.’, ‘woo-pagseguro-rm’ ) ); wc_reduce_stock_levels(
   $order_id ); } else { $order->add_order_note( __( ‘PagSeguro: Payment approved.’,‘
   woo-pagseguro-rm’ ) );
 *  // Changing the order for processing and reduces the stock.
    $order->payment_complete(
   sanitize_text_field( (string) $posted->code ) ); }
 *  break;
    case 4: $order->add_order_note( __( ‘PagSeguro: Payment completed and
   credited to your account.’, ‘woo-pagseguro-rm’ ) );
 *  break;
    case 5: $order->update_status( ‘on-hold’, __( ‘PagSeguro: Payment came
   into dispute.’, ‘woo-pagseguro-rm’ ) ); $this->send_email( /* translators: %s:
   order number */ sprintf( __( ‘Payment for order %s came into dispute’, ‘woo-pagseguro-
   rm’ ), $order->get_order_number() ), __( ‘Payment in dispute’, ‘woo-pagseguro-
   rm’ ), /* translators: %s: order number */ sprintf( __( ‘Order %s has been marked
   as on-hold, because the payment came into dispute in PagSeguro.’, ‘woo-pagseguro-
   rm’ ), $order->get_order_number() ) );
 *  break;
    case 6: $order->update_status( ‘refunded’, __( ‘PagSeguro: Payment refunded.’,‘
   woo-pagseguro-rm’ ) ); $this->send_email( /* translators: %s: order number */
   sprintf( __( ‘Payment for order %s refunded’, ‘woo-pagseguro-rm’ ), $order->get_order_number()),
   __( ‘Payment refunded’, ‘woo-pagseguro-rm’ ), /* translators: %s: order number*/
   sprintf( __( ‘Order %s has been marked as refunded by PagSeguro.’, ‘woo-pagseguro-
   rm’ ), $order->get_order_number() ) );
 *  if ( function_exists( ‘wc_increase_stock_levels’ ) ) {
    wc_increase_stock_levels(
   $order_id ); }
 *  break;
    case 7: $order->update_status( ‘cancelled’, __( ‘PagSeguro: Payment 
   canceled.’, ‘woo-pagseguro-rm’ ) );
 *  if ( function_exists( ‘wc_increase_stock_levels’ ) ) {
    wc_increase_stock_levels(
   $order_id ); }
 *  break;
 *  default:
    break; } } else { if ( ‘yes’ === $this->debug ) { $this->log->add(
   $this->id, ‘Error: Order Key does not match with PagSeguro reference.’ ); } }}}
 *  /**
    * Thank You page message. * * [@param](https://wordpress.org/support/users/param/)
   int $order_id Order ID. */ public function thankyou_page( $order_id ) { $order
   = wc_get_order( $order_id ); // WooCommerce 3.0 or later. if ( method_exists(
   $order, ‘get_meta’ ) ) { $data = $order->get_meta( ‘_wc_pagseguro_payment_data’);}
   else { $data = get_post_meta( $order->id, ‘_wc_pagseguro_payment_data’, true );//
   @codingStandardsIgnoreLine }
 *  if ( isset( $data[‘type’] ) ) {
    wc_get_template( ‘payment-instructions.php’,
   array( ‘type’ => $data[‘type’], ‘link’ => $data[‘link’], ‘method’ => $data[‘method’],‘
   installments’ => $data[‘installments’], ), ‘woocommerce/pagseguro/’, WC_PagSeguro::
   get_templates_path() ); } }
 *  /**
    * Add content to the WC emails. * * [@param](https://wordpress.org/support/users/param/)
   WC_Order $order Order object. * [@param](https://wordpress.org/support/users/param/)
   bool $sent_to_admin Send to admin. * [@param](https://wordpress.org/support/users/param/)
   bool $plain_text Plain text or HTML. * [@return](https://wordpress.org/support/users/return/)
   string */ public function email_instructions( $order, $sent_to_admin, $plain_text
   = false ) { // WooCommerce 3.0 or later. if ( method_exists( $order, ‘get_meta’)){
   if ( $sent_to_admin || ‘on-hold’ !== $order->get_status() || $this->id !== $order-
   >get_payment_method() ) { return; }
 *  $data = $order->get_meta( ‘_wc_pagseguro_payment_data’ );
    } else { if ( $sent_to_admin
   || ‘on-hold’ !== $order->status || $this->id !== $order->payment_method ) { return;}
 *  $data = get_post_meta( $order->id, ‘_wc_pagseguro_payment_data’, true );
    }
 *  if ( isset( $data[‘type’] ) ) {
    if ( $plain_text ) { wc_get_template( ’emails/
   plain-instructions.php’, array( ‘type’ => $data[‘type’], ‘link’ => $data[‘link’],‘
   method’ => $data[‘method’], ‘installments’ => $data[‘installments’], ), ‘woocommerce/
   pagseguro/’, WC_PagSeguro::get_templates_path() ); } else { wc_get_template( ’
   emails/html-instructions.php’, array( ‘type’ => $data[‘type’], ‘link’ => $data[‘
   link’], ‘method’ => $data[‘method’], ‘installments’ => $data[‘installments’],),‘
   woocommerce/pagseguro/’, WC_PagSeguro::get_templates_path() ); } } } }
 *  [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/)
 * (@patrick3623)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12907048)
 * Baixei o projeto, na verdade não tem nada ver com php, vai ser preciso mexer 
   no JS, já lhe envio o trecho…
 *  Thread Starter [tharlescunha](https://wordpress.org/support/users/tharlescunha/)
 * (@tharlescunha)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12907061)
 * Ok, estou no aguardo, muito brigado pela ajuda.
 *  [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/)
 * (@patrick3623)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12907112)
 * Em:
    [https://github.com/claudiosanches/woocommerce-pagseguro/blob/master/assets/js/frontend/transparent-checkout.js](https://github.com/claudiosanches/woocommerce-pagseguro/blob/master/assets/js/frontend/transparent-checkout.js)
 * Na linha 283 você precisa alterar a estrutura de repetição para apenas o limite
   que você precisa aqui
 * $.each( data.installments[brand], function( index, installment ) {
    instalmments.
   append( pagSeguroGetInstallmentOption( installment ) ); });
 * Antes disso precisa reduzir o array:
 * data.installments[brand].length = 3;
    $.each( data.installments[brand], function(
   index, installment ) { instalmments.append( pagSeguroGetInstallmentOption( installment));});
 * Na teoria isso deve funcionar…
 *  [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/)
 * (@patrick3623)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12907224)
 * Lembrando que após editar o arquivo .js, é necessário gerar um arquivo .min.js
   substituindo o antigo.
    -  This reply was modified 5 years, 11 months ago by [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/).
 *  Thread Starter [tharlescunha](https://wordpress.org/support/users/tharlescunha/)
 * (@tharlescunha)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12909772)
 * Eu tinha alterado e não tinha funcionado, eu estou tentado apagar o arquivo transparent-
   checkout.min.js, mas não estou conseguindo, como que eu gero outro ??
 *  [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/)
 * (@patrick3623)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12967160)
 * Tem várias formas, dependendo da IDE ou editor que usa, mas da pra fazer online.
 * [https://javascript-minifier.com/](https://javascript-minifier.com/)
 * jogo o código do arquivo.js em um lado e ele gera o .min.js basta criar um arquivo
   com o nome correto e substituir.
 *  [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/)
 * (@patrick3623)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12967170)
 * Se tiver problemas em editar ou remover o arquivo provavel que seja a permissão
   desse arquivo.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Limitar Parcelamento.’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pagseguro/assets/icon-256x256.png?rev=1356960)
 * [Claudio Sanches - PagSeguro for WooCommerce](https://wordpress.org/plugins/woocommerce-pagseguro/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pagseguro/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pagseguro/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pagseguro/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pagseguro/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pagseguro/reviews/)

 * 13 replies
 * 2 participants
 * Last reply from: [Patrick Ferro Ribeiro](https://wordpress.org/support/users/patrick3623/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/limitar-parcelamento-2/#post-12967170)
 * Status: not resolved