php - "Add to WishList" and "BuyNow" buttons are missing | Wordpress Woocommerce -


in wordpress woo-commerce website

  • on product catalogue page - both buttons "buy now" , "add wishlist" missing
  • on single product page - "buy now" button missing.

in wordpress admin found php wishlist, there wrong in code has disabled button "add wishlist" ? how enable "add wishlist" button ?

<?php /**  * wishlist page template  *  * @author inspiration themes  * @package yith woocommerce wishlist  * @version 1.0.0  */  global $wpdb, $yith_wcwl, $woocommerce;  if( isset( $_get['user_id'] ) && !empty( $_get['user_id'] ) ) {     $user_id = $_get['user_id']; } elseif( is_user_logged_in() ) {     $user_id = get_current_user_id(); }  $current_page = 1; $limit_sql = '';  if( $pagination == 'yes' ) {     $count = array();      if( is_user_logged_in() ) {         $count = $wpdb->get_results( $wpdb->prepare( 'select count(*) `cnt` `' . yith_wcwl_table . '` `user_id` = %d', $user_id  ), array_a );         $count = $count[0]['cnt'];     } elseif( yith_usecookies() ) {         $count[0]['cnt'] = count( yith_getcookie( 'yith_wcwl_products' ) );     } else {         $count[0]['cnt'] = count( $_session['yith_wcwl_products'] );     }      $total_pages = $count/$per_page;     if( $total_pages > 1 ) {         $current_page = max( 1, get_query_var( 'page' ) );          $page_links = paginate_links( array(             'base' => get_pagenum_link( 1 ) . '%_%',             'format' => '&page=%#%',             'current' => $current_page,             'total' => $total_pages,             'show_all' => true         ) );     }      $limit_sql = "limit " . ( $current_page - 1 ) * 1 . ',' . $per_page; }  if( is_user_logged_in() )     { $wishlist = $wpdb->get_results( $wpdb->prepare( "select * `" . yith_wcwl_table . "` `user_id` = %s" . $limit_sql, $user_id ), array_a ); } elseif( yith_usecookies() )     { $wishlist = yith_getcookie( 'yith_wcwl_products' ); } else     { $wishlist = isset( $_session['yith_wcwl_products'] ) ? $_session['yith_wcwl_products'] : array(); }  // start wishlist page printing $woocommerce->show_messages() ?> <div id="yith-wcwl-messages"></div>  <form id="yith-wcwl-form" action="<?php echo esc_url( $yith_wcwl->get_wishlist_url() ) ?>" method="post">     <?php     do_action( 'yith_wcwl_before_wishlist_title' );      $wishlist_title = get_option( 'yith_wcwl_wishlist_title' );     if( !empty( $wishlist_title ) )         { echo apply_filters( 'yith_wcwl_wishlist_title', '<h2>' . $wishlist_title . '</h2>' ); }      do_action( 'yith_wcwl_before_wishlist' );     ?>     <table class="shop_table cart wishlist_table" cellspacing="0">         <thead>             <tr>                 <th class="product-thumbnail"><?php _e( 'image', 'maxshop' ) ?></th>                 <th class="product-name"><?php _e( 'product name', 'maxshop' ) ?></th>                 <th class="product-price"><?php _e( 'unit price', 'maxshop' ) ?></th>                 <th><?php _e( 'stock status', 'maxshop' ) ?></th>                 <th><?php _e( 'action', 'maxshop' ) ?></th>                 <th class="product-remove"><?php _e( 'remove', 'maxshop' ) ?></th>             </tr>         </thead>         <tbody>             <?php                         if( count( $wishlist ) > 0 ) :                 foreach( $wishlist $values ) :                        if( !is_user_logged_in() ) {                         if( isset( $values['add-to-wishlist'] ) && is_numeric( $values['add-to-wishlist'] ) ) {                             $values['prod_id'] = $values['add-to-wishlist'];                             $values['id'] = $values['add-to-wishlist'];                         } else {                             $values['prod_id'] = $values['product_id'];                             $values['id'] = $values['product_id'];                         }                     }                      $product_obj = get_product( $values['prod_id'] );                      if( $product_obj !== false && $product_obj->exists() ) : ?>                     <tr id="yith-wcwl-row-<?php echo $values['id'] ?>">                         <td class="product-thumbnail">                             <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $values['prod_id'] ) ) ) ?>">                                 <?php echo $product_obj->get_image() ?>                             </a>                         </td>                         <td class="product-name">                             <a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $values['prod_id'] ) ) ) ?>"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product_obj->get_title(), $product_obj ) ?></a>                         </td>                         <td class="product-price">                             <?php                             if( get_option( 'woocommerce_display_cart_prices_excluding_tax' ) == 'yes' )                                 { echo apply_filters( 'woocommerce_cart_item_price_html', woocommerce_price( $product_obj->get_price_excluding_tax() ), $values, '' ); }                             else                                 { echo apply_filters( 'woocommerce_cart_item_price_html', woocommerce_price( $product_obj->get_price() ), $values, '' ); }                                 ?>                         </td>                         <td class="product-stock-status">                             <?php                             $availability = $product_obj->get_availability();                             $stock_status = $availability['class'];                              if( $stock_status == 'out-of-stock' ) {                                 $stock_status = "out";                                 echo '<span class="wishlist-out-of-stock">' . __( 'out of stock', 'maxshop' ) . '</span>';                                } else {                                 $stock_status = "in";                                 echo '<span class="wishlist-in-stock">' . __( 'in stock', 'maxshop' ) . '</span>';                             }                             ?>                         </td>                         <td class="product-add-to-cart">                             <?php echo yith_wcwl_ui::add_to_cart_button( $values['prod_id'], $availability['class'] ) ?>                         </td>                         <td class="product-remove"><div><a href="javascript:void(0)" onclick="remove_item_from_wishlist( '<?php echo esc_url( $yith_wcwl->get_remove_url( $values['id'] ) )?>', 'yith-wcwl-row-<?php echo $values['id'] ?>');" class="remove" title="<?php _e( 'remove product', 'maxshop' ) ?>">&times;</a></td>                      </tr>                     <?php                     endif;                 endforeach;             else: ?>                 <tr>                     <td colspan="6" class="wishlist-empty"><?php _e( 'no products added wishlist', 'maxshop' ) ?></td>                 </tr>                    <?php             endif;              if( isset( $page_links ) ) : ?>             <tr>                 <td colspan="6"><?php echo $page_links ?></td>             </tr>             <?php endif ?>         </tbody>      </table>      <?php      do_action( 'yith_wcwl_after_wishlist' );       yith_wcwl_get_template( 'share.php' );       do_action( 'yith_wcwl_after_wishlist_share' );      ?> </form> 

style.css wishlist:

/****************************wishlist**********************************/ .wishlist_table{margin: 20px 0;} .wishlist_table thead tr{     background: #f0f0f0;     width: 100%; } .wishlist_table th{     height: 72px;     line-height: 72px;     padding: 0px;     text-align: center;     text-transform: uppercase;     width: 175px;     color: #000000;     font: 15px 'arial', sans-serif;     border: 1px solid #dfdfdf;     vertical-align: middle; } .wishlist_table td{     text-align: center !important;     width: 150px;     height: 80px;     padding: 22px;     color: #000000;     font: 15px 'arial', sans-serif;     border: 1px solid #dfdfdf;     vertical-align: middle; } /*=============================wishlist button===============================*/ .yith-wcwl-add-to-wishlist{     width: 145px;     margin-bottom: 15px; } .icon .yith-wcwl-add-to-wishlist{     width: 42px;     display: inline-block;     margin: 0; } .icon .yith-wcwl-add-to-wishlist img{     display: none !important; } .icon .yith-wcwl-add-to-wishlist span{     font-size: 9px; } .icon div.clear{     display: none; } .icon .yith-wcwl-wishlistexistsbrowse, .icon .yith-wcwl-wishlistaddedbrowse{     font-size: 8px;     height: 21px; } .icon .yith-wcwl-wishlistexistsbrowse span, .icon .yith-wcwl-wishlistaddedbrowse span{     display: none; } #selectpage{display:none} table{border-collapse:collapse;border-spacing:0;empty-cells:show;border:1px solid #cbcbcb} table caption{color:#000;font:italic 85%/1 arial,sans-serif;padding:1em 0;text-align:center} table td, table th{border-left:1px solid #cbcbcb;border-width:0 0 0 1px;font-size:inherit;margin:0;overflow:visible;padding:6px 12px} table td:first-child,table th:first-child{border-left-width:0} table thead{background:#e0e0e0;color:#000;text-align:left;vertical-align:bottom} table td{background-color:transparent} .table-odd td{background-color:#f2f2f2} .table-striped tr:nth-child(2n-1) td{background-color:#f2f2f2} .table-bordered td{border-bottom:1px solid #cbcbcb} .table-bordered tbody>tr:last-child td, .table-horizontal tbody>tr:last-child td{border-bottom-width:0} .table-horizontal td, .table-horizontal th{border-width:0 0 1px;border-bottom:1px solid #cbcbcb} .table-horizontal tbody>tr:last-child td{border-bottom-width:0} .top-spacing{margin-top:40px !important; margin-bottom:10px}  .toggle-trigger {     background: #fff url("images/plus.png") 90% center no-repeat;     cursor: pointer;     color:#333;     transition: 0.17s ease-in-out;     -moz-transition: 0.17s ease-in-out;     -webkit-transition: 0.17s ease-in-out;     -o-transition: 0.17s ease-in-out; }  .toggle-trigger.open {     color:#fff;     background: #6a6a6a url("images/minas.png") 90% center no-repeat }  .toggle-container {     padding: 12px 22px;     border: 1px solid #e8e8e8;     border-top: none; } .container{max-width:100% !important} .nav-tabs li, .work_slide li{list-style:none !important; margin-left:0 !important; line-height:1.3} .btn [class^="icon-"], .btn [class*=" icon-"]{margin-right:6px !important} strong {font-weight:bold} em {font-style:italic} .flex-video iframe, ifame{max-width:100% !important; } .woocommerce li {list-style: none !important;margin-left:0} .shopping-cart .title li, .shopping-cart ul li{margin-left:0 !important} .showlogin {} /*::-moz-selection { background: #f71919; color: #fff; text-shadow: none; } ::selection { background: #f71919; color: #fff; text-shadow: none; }*/ #wc-sorting {margin:-58px 0 40px 16px} .product figure {border:1px solid #fff; border-bottom:none} .product figure {border:1px solid #fff; border-bottom:none} .related.products figure, .related.products figure > {width:100% !important; height:auto !important}  .related.products h2 {margin-bottom:12px} .related.products li{border-bottom:none !important} .sort-select {margin:-58px 0 38px 10px;display: none;} .sub-menu ul.sub-menu {left: 150px; top:50px}   .single-product-right{ margin-left:10px} .product-left .images {width:auto !important} .thumbnails {margin-bottom:10px} .product-detail .compare.big-button{margin-top:37px} .no-shadow:hover{box-shadow:none !important} .single-product .yith-wcwl-add-to-wishlist{float:left; width:124px} .single-product a.compare {width:40px; float:left; margin-top:10px} .single-product .product-detail div.clear {display:none} 

and enable buynow button on both product catalogue page , single product page, not find style code, suggestions ?

the disparation of buy button common issue.

i don't think wishlist plugin has see bug.

you can following steps figure out :

1) desactive cache plugin, , try access throught other navigator or in private navigation mode.

then

2) has product price?

3) in stock?

those steps should show error in product's config.

if prefer go right in code, take product type (usually variable or simple) go on project on file /wp-content/plugins/woocommerce/templates/single-product/add-to-cart/{product_type}.php or /wp-content/themes/{your_theme}/woocommerce/single-product/add-to-cart/{product_type}.php if second 1 exists.

and take out different verifications, til button appears.

don't forget revert modifications if edited plugin's folder.

after if have see nothing, desactive plugins , re-active them 1 1 (obviously woocommerce in first).

btw, plugins using?

hope it's gonna you


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -