Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter kopka

    (@kopka)

    Fatal error: Uncaught Error: Call to undefined method WC_Product::set_type()

    set type does not exist 🙂 but I already solved it, but thanks for the help.

    Thread Starter kopka

    (@kopka)

    $product = new WC_Product_Subscription();
    
    $subscription_price = 60;
    
    $product->set_name('test');
    
    $product->set_status('publish');
    
    $product->set_regular_price($subscription_price);
    
    $product->set_virtual( false );
    
    $product_id = $product->save();
    
    
    update_post_meta($product_id, '_subscription_period', 'month');
    
    update_post_meta($product_id, '_subscription_price', $subscription_price);
    
    update_post_meta($product_id, '_subscription_length', 1);
    
    update_post_meta($product_id, '_subscription_trial_length', 0);
    
    update_post_meta($product_id, '_subscription_trial_period', 'day');
    
    update_post_meta($product_id, '_subscription_sign_up_fee', '');
    
    update_post_meta($product_id, '_subscription_period_interval', 1);
    
    update_post_meta($product_id, '_subscription_limit', 'no');
    
    update_post_meta($product_id, '_subscription_one_time_shipping', 'no');
    
    update_post_meta($product_id, '_subscription_payment_sync_date', 0);
    
    $category = get_term_by( 'slug', 'subscription', 'product_type' );
    
    if ($category) {
    
    wp_set_object_terms( $product_id, $category->term_id, 'product_type', true );
    
    }

    Done

    • This reply was modified 2 years, 11 months ago by kopka.
    Thread Starter kopka

    (@kopka)

    thx

    Thread Starter kopka

    (@kopka)

    Hi, I need to achieve that when the lightbox is open there is a button to download the given photo.

    Thread Starter kopka

    (@kopka)

    hi, i came after that. The error was on the server

    Thread Starter kopka

    (@kopka)

    hi,
    30 x warring:

    Backtrace from warning 'Trying to get property 'count' of non-object' at /wp-includes/class-wp-term-query.php 758:
    
    wp-includes/class-wp-term-query.php 288 calling get_terms()
    wp-includes/taxonomy.php 1179 calling query()
    wp-content/plugins/wordpress-seo/admin/class-primary-term-admin.php 268 calling get_terms()
    calling map_taxonomies_for_js()
    wp-content/plugins/wordpress-seo/admin/class-primary-term-admin.php 251 calling array_map()
    wp-content/plugins/wordpress-seo/admin/class-primary-term-admin.php 132 calling get_mapped_taxonomies_for_js()
    wp-includes/class-wp-hook.php 288 calling enqueue_assets()
    wp-includes/class-wp-hook.php 312 calling apply_filters()
    wp-includes/plugin.php 478 calling do_action()
    wp-admin/admin-header.php 104 calling do_action()
    wp-admin/edit-form-advanced.php 419 calling require_once()
    wp-admin/post-new.php 75 calling include()

    1x

    Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in /wp-includes/functions.php on line 0
    
    Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0
    Thread Starter kopka

    (@kopka)

    hi, I did it according to the instructions.
    I have created a product. Showing errors

    warning 1 :

    
    wp-config.php 206 calling trigger_error()
    wp-load.php 37 calling require_once()
    wp-admin/admin.php 34 calling require_once()
    wp-admin/post-new.php 10 calling require_once()
    

    warning 2:

    
    wp-includes/functions.php 6029 calling header()
    wp-includes/class-wp-hook.php 286 calling send_frame_options_header()
    wp-includes/class-wp-hook.php 312 calling apply_filters()
    wp-includes/plugin.php 478 calling do_action()
    wp-admin/admin.php 170 calling do_action()
    wp-admin/post-new.php 10 calling require_once()
     
Viewing 7 replies - 1 through 7 (of 7 total)