Update products, terms and relations via SQL
Update products, terms and relations via SQL
Update products, terms and relations via SQL
Product categories in Woocommerce is a term, so you can get the categories with get_the_terms function: echo ‘<h3><a href=”‘ . get_the_permalink() . ‘”>’ . get_the_title() . ‘</a></h3>’; echo ‘<span style=”display:none;” class=”prodcat’; $categories = get_the_terms( get_the_ID(), ‘product_cat’ ); foreach ($categories as $category) { echo ‘ ‘ . $category->name . ”; }; echo ‘”> </span>’;
Put domain.com/shop/product-name as a custom link in your menu of site. and make it as a home page so whenever someone clicks on domain.com/shop, it will go to your one page product.
Hook into add_to_cart hook add_action(‘woocommerce_add_to_cart’, ‘create_files_for_cart’); function create_files_for_cart() { // Your code that created the file using the dated the user selected // More code to add the file created to cart } The code to create the downloadable file product is similar to the code in this answer Add the product to cart with … Read more
Adding more than one item to Woocommerce cart
Create woocommerce order on new user registration
It seems your using a commercial theme ‘Jupiter’, and it looks like your having trouble styling the related products section. You probably do best if you go ask the creator of the Jupiter theme how to achieve this.
This code will do what you want. It will redirect to the latest product added if you add ?latest_product to your site’s URL. So the dynamic link would be http://example.com/?latest_product function wpse_274155_redirect_latest_product() { // If URL has ?latest_product query string. if ( isset( $_GET[‘latest_product’] ) ) { // Get latest product. $latest_products = get_posts( array( … Read more
The hook woocommerce_email_order_details has 4 parameters which can help you to identify the correct message. add_action( ‘woocommerce_email_order_details’, ‘so274215_add_transaction_id’, 10, 4); function so274215_add_transaction_id( $order, $sent_to_admin, $plain_text, $email ){ // decide here wether to show your transaction id if ( ! $sent_to_admin ) echo ‘<span style=”color:#555;font-size:1.5em;”>Transaction ID: ‘.get_post_meta( $order->id, “_transaction_id”, true ).'</span>’; } As far as I … Read more
This is how I used WooCommerce to get the country code on a recent project, using the geolocate_ip method of the WC_Geolocation class. $country = ‘US’; if (class_exists(‘WC_Geolocation’)) { $location = WC_Geolocation::geolocate_ip(”, true, false); if (isset($location[‘country’])) { $country = $location[‘country’]; } } switch ($country) { case ‘AU’: break; case ‘US’: break: }