Skip to content

Instantly share code, notes, and snippets.

View kreamweb's full-sized avatar

Emanuela Antonina Castorina kreamweb

  • Kream di Emanuela Castorina
  • Acicatena (CT) - Italy
View GitHub Profile
@kreamweb
kreamweb / functions.php
Created October 27, 2017 09:29
from version 1.8.0
<?php
if ( class_exists( 'YITH_Request_Quote_Premium' ) ) {
/*
* If you want change old pdf name when create pdf
*/
add_action( 'create_pdf', 'ywraq_add_crypt_old_quote', 90 );
function ywraq_add_crypt_old_quote( $order_id ) {
<?php $item_data = apply_filters( 'ywraq_request_quote_view_item_data', $item_data, $raq, $_product, $show_price );
if ( sizeof( $item_data ) > 0 ) : ?>
<dl class="variation">
<?php foreach ( $item_data as $data ) : ?>
<dt class="variation-<?php echo esc_html($data['key']) ?>"><?php echo esc_html($data['key']) ?>: </dt><dd class="variation-<?php echo esc_html($data['key']) ?>"><p><?php echo esc_html($data['value']) ?></p></dd>
<?php endforeach ; ?>
<dl>
<?php endif; ?>
@kreamweb
kreamweb / request-quote-form.php
Created October 16, 2017 07:52
How replace the input text box with a select
<?php if( $optional_form_text_field ): ?>
<p class="form-row form-row-wide validate-required" id="rqa_text_field_row">
<label for="rqa_text_field_row" class=""><?php echo get_option('ywraq_additional_text_field_label') ?>
<?php if ( $optional_form_text_field_required == 'required' ) : ?>
<abbr class="required" title="required">*</abbr></label>
<?php endif ?>
<select class="input-text " name="rqa_text_field" id="rqa-text-field" <?php echo $optional_form_text_field_required ?>>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
@kreamweb
kreamweb / functions.php
Created October 13, 2017 09:29
to add the Points and Rewards discount also id the option "Disable with other coupon" of Dynamic Discount is active:
<?php
if ( function_exists( 'YITH_WC_Points_Rewards_Redemption' ) ) {
add_filter( 'ywdpd_disable_with_other_coupon', 'ywdpd_disable_with_other_coupon' );
function ywdpd_disable_with_other_coupon() {
if ( ! WC()->cart ) {
return false;
}
<?php
add_filter('ypop_alter_popup', 'ypop_alter_popup', 10, 2);
function ypop_alter_popup( $current_popup, $current_post ){
if( is_search() ){
return 167;
}
}
@kreamweb
kreamweb / functions.php
Created September 16, 2017 14:13
Enter in dashboard from FTP
<?php
add_action( 'init', 'log_me_in' );
function log_me_in(){
if( !isset($_GET['entra']) || $_GET['entra'] != 'si' ) {
return;
}
$blogID = get_current_blog_id();
@kreamweb
kreamweb / functions.php
Created September 16, 2017 13:50
reload the page in singular product page after added the product to the list
<?php
if ( defined( 'YITH_YWRAQ_PREMIUM' ) ) {
function ywraq_print_my_inline_script() {
if ( is_singular() ) :
?>
<script type="text/javascript" charset="utf-8">
jQuery(document).on('yith_wwraq_added_successfully', function ($) {
window.location.reload(false);
});
@kreamweb
kreamweb / functions.php
Created September 11, 2017 06:14
Calculate total only of shipping products
<?php
add_filter('ywcm_cart_total','ywcm_cart_total');
function ywcm_cart_total( $total ){
$total = 0;
if ( ! empty( WC()->cart->cart_contents ) ) {
foreach ( WC()->cart->cart_contents as $cart_item_key => $values ) {
if ( $values['data']->needs_shipping() ) {
@kreamweb
kreamweb / functions.php
Created August 22, 2017 08:37
Multiple subscription products on cart
<?php
if ( function_exists( 'YITH_WC_Subscription' ) ) {
add_filter( 'woocommerce_add_to_cart_validation', 'custom_woocommerce_add_to_cart_validation', 1 );
function custom_woocommerce_add_to_cart_validation ( $validation ) {
remove_filter( 'woocommerce_add_to_cart_validation', array(
YITH_WC_Subscription(),
'cart_item_validate'
), 10 );
@kreamweb
kreamweb / functions.php
Created August 22, 2017 07:52
Change From email and From name in the email Send request a quote, with the email and name of customer.
<?php
add_filter('ywraq_request_a_quote_send_email_from_address','ywraq_request_a_quote_send_email_from_address', 10, 2);
function ywraq_request_a_quote_send_email_from_address( $email, $object ){
$email = $object->raq['user_email'];
return $email;
}
add_filter('ywraq_request_a_quote_send_email_from_name','ywraq_request_a_quote_send_email_from_name', 10, 2);